source: branches/v2.9/classes/mm-progs/master_volume/volume.c

Last change on this file was 2, checked in by stevenhl, 8 years ago

Import sources from cwmm-full.zip dated 2005-03-21

File size: 22.8 KB
Line 
1/*
2 * Volume.exe (C) Chris Wohlgemuth 2003
3 *
4 */
5/*
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2, or (at your option)
9 * any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; see the file COPYING. If not, write to
18 * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
19 */
20/*
21 * If you need another license for your project/product (commercial,
22 * noncommercial, whatever) contact me at
23 *
24 * http://www.os2world.com/cdwriting
25 * http://www.geocities.com/SiliconValley/Sector/5785/
26 *
27 */
28
29#define INCL_DOS
30#define INCL_GPI
31#define INCL_DOSFILEMGR
32#define INCL_DOSERRORS
33#define INCL_WIN
34#define INCL_OS2MM
35#define INCL_MMIOOS2
36#define INCL_MCIOS2
37#define INCL_SECONDARYWINDOW
38#define INCL_GRAPHICBUTTON
39#include <os2.h>
40#include <sw.h>
41#include <sys\types.h>
42#include <sys\stat.h>
43#include <stdio.h>
44#include <string.h>
45#include <stdlib.h>
46#include "os2me.h"
47#include "common.h"
48#include "mmres.h"
49#include "mmprogs_defaults.h"
50
51#include "sys_funcs.h"
52
53#define ACTION_SETVOLUME 1L
54#define ACTION_QUERYVOLUME 2L
55
56//#define INI_NAME_APP "volume"
57
58#define INI_TBVISIBLE_KEY "tbVisible"
59#define INI_NAME_COLOR "color"
60#define INI_BTNBGCLR_KEY "btnbg"
61#define INI_BTNFGCLR_KEY "btnfg"
62
63#if 0
64#define INI_BGCLR_KEY "bg"
65#define INI_FGCLR_KEY "fg"
66#define INI_ACTIVETBBGCLR_KEY "activetbbg"
67#define INI_INACTIVETBBGCLR_KEY "inactivetbbg"
68#define INI_ACTIVETBFGCLR_KEY "activetbfg"
69#define INI_INACTIVETBFGCLR_KEY "inactivetbfg"
70#endif
71char logName[]="volume.log";
72
73BOOL bHaveWindowPos=FALSE;
74
75BOOL bMute=FALSE;
76HMODULE RESSOURCEHANDLE=0;
77int bTBVisible=0;
78ULONG ulTBCy;
79
80HWND hwndThread;
81
82char* params[5];
83char chrIniFile[CCHMAXPATH];
84
85//ULONG cwQueryOSRelease();
86void pmUsage();
87BOOL IniSaveWindowPos(char * iniFile, char* chrApp, char *chrKey, HWND hwnd);
88BOOL IniRestoreWindowPos(char * iniFile, char* chrApp, char *chrKey, HWND hwnd);
89BOOL IniSaveInt(char * iniFile, char* chrApp, char *chrKey, int theInt);
90int IniRestoreInt(char * iniFile, char* chrApp, char *chrKey, int defaultInt);
91BOOL IniSaveData(char * iniFile, char* chrApp, char *chrKey, void* theData, ULONG ulSize);
92BOOL IniRestoreData(char * iniFile, char* chrApp, char *chrKey, void * theData, ULONG* ulMaxSize);
93BOOL IniSaveWindowClrs(char * chrIniFile, char* chrApp , HWND hwnd);
94BOOL IniRestoreWindowClrs(char * chrIniFile, char* chrApp , HWND hwnd);
95BOOL HlpBuildMMProgIniFileName(char* chrProgname, char * chrBuffer, ULONG ulBufferSize);
96HMODULE queryResModuleHandle(char *chrExePath);
97void freeResHandle();
98
99ULONG queryMasterVolume(void)
100{
101 char chrCommand[50];
102 char retMsg[20];
103 ULONG rc;
104
105 strcpy(chrCommand, "MASTERAUDIO QUERY VOLUME WAIT");
106 rc = mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);
107 if((rc & 0x0000ffff)!=MCIERR_SUCCESS) {
108 /* Problem with MCI. */
109 return 75;
110 }
111 else
112 return atoi(retMsg);
113}
114
115void setMasterVolume(HWND hwnd, SHORT sVolumeLevel)
116{
117 char chrCommand[500];
118 char retMsg[20];
119 ULONG rc;
120
121 WinPostMsg(hwndThread, WM_APPTERMINATENOTIFY, MPFROMLONG(ACTION_SETVOLUME), MPFROMSHORT(sVolumeLevel));
122 return;
123
124 sprintf(chrCommand, "MASTERAUDIO volume %d wait ", sVolumeLevel);
125 rc = mciSendString(chrCommand, retMsg, sizeof(retMsg), hwnd, 2);
126 if((rc & 0x0000ffff)!=MCIERR_SUCCESS) {
127 /* Problem with MCI. */
128 mciGetErrorString(rc, chrCommand,sizeof(chrCommand));
129 WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, chrCommand, "", 1234, MB_MOVEABLE);
130 //DosBeep(100, 30);
131 return ;
132 }
133}
134
135/* Masteraudio does not support NOTIFY so use a thread to prevent PM freeze */
136MRESULT EXPENTRY volumeObjectProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
137{
138 switch(msg)
139 {
140 case WM_APPTERMINATENOTIFY:
141 {
142 char chrCommand[500];
143 char retMsg[20];
144 ULONG rc;
145
146 /* This queue is blocked until the query is over. This is the reason we've chosen an object window. */
147 switch(LONGFROMMP(mp1))
148 {
149 case ACTION_SETVOLUME:
150 {
151
152#if 0
153 ULONG mastervolume; /* Set to master volumepercentage
154 percentage by this example */
155
156 USHORT usDeviceID=0;
157 MCI_MASTERAUDIO_PARMS masteraudioparms;
158 MCI_OPEN_PARMS openParms;
159
160
161 memset(&openParms,0, sizeof(openParms));
162 openParms.pszDeviceType="Masteraudio";
163
164 rc=mciSendCommand(0, /* Device */
165 MCI_OPEN, /* Master audio message */
166 MCI_WAIT ,
167 /* Flags for this message */
168 (PVOID) &openParms, /* Data structure */
169 0); /* User parm */
170
171 mciGetErrorString(rc,chrCommand, sizeof(chrCommand));
172 //sprintf(chrCommand, "%x", rc);
173 WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, chrCommand, "", 1234, MB_MOVEABLE);
174 DosBeep(5000, 10);
175 usDeviceID=openParms.usDeviceID;
176 memset(&masteraudioparms,0, sizeof(masteraudioparms));
177 masteraudioparms.ulMasterVolume=32;
178 /* Get current system master
179 volume setting */
180
181 mciSendCommand(usDeviceID, /* Device */
182 MCI_MASTERAUDIO, /* Master audio message */
183 MCI_WAIT | MCI_MASTERVOL,
184 /* Flags for this message */
185 (PVOID) &masteraudioparms, /* Data structure */
186 0); /* User parm */
187
188 /* Get current system master
189 volume setting */
190
191 mciSendCommand(usDeviceID, /* Device */
192 MCI_MASTERAUDIO, /* Master audio message */
193 MCI_WAIT | MCI_QUERYCURRENTSETTING | MCI_MASTERVOL,
194 /* Flags for this message */
195 (PVOID) &masteraudioparms, /* Data structure */
196 0); /* User parm */
197
198 mastervolume = masteraudioparms.ulReturn;
199 DosBeep(500, 10);
200#endif
201
202 sprintf(chrCommand, "MASTERAUDIO VOLUME %d WAIT", SHORT1FROMMP(mp2));
203 // sprintf(chrCommand, "MASTERAUDIO VOLUME 39", SHORT1FROMMP(mp2));
204 rc = mciSendString(chrCommand, retMsg, sizeof(retMsg), 0, 0);
205 //DosBeep(5000, 20);
206
207 if((rc & 0x0000ffff)!=MCIERR_SUCCESS) {
208 /* Problem with MCI. */
209 // DosBeep(1000, 10);
210 break;
211 }
212
213 break;
214 }
215 case ACTION_QUERYVOLUME:
216 break;
217 default:
218 break;
219 }
220 return FALSE;
221 }
222 case WM_CLOSE:
223 WinPostMsg(hwnd,WM_QUIT,(MPARAM)0,(MPARAM)0);
224 default:
225 break;
226 }
227 return WinDefWindowProc( hwnd, msg, mp1, mp2);
228}
229
230void _Optlink volumeThreadFunc (void *arg)
231{
232 HAB hab;
233 HMQ hmq;
234 QMSG qmsg;
235
236 hab=WinInitialize(0);
237 if(hab) {
238 hmq=WinCreateMsgQueue(hab,0);
239 if(hmq) {
240
241 if((hwndThread=WinCreateWindow(HWND_OBJECT, WC_STATIC, "", 0,0,0,0,0, NULLHANDLE,
242 HWND_BOTTOM, 1, NULLHANDLE, NULLHANDLE))==NULLHANDLE) {
243 WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, "Can't start thread. Aborting...", "", 1234, MB_MOVEABLE);
244 exit(1);
245 }
246 WinSubclassWindow(hwndThread,&volumeObjectProc);
247 /* Window created. */
248
249 while(WinGetMsg(hab,&qmsg,(HWND)NULL,0,0))
250 WinDispatchMsg(hab,&qmsg);
251 WinDestroyWindow(hwndThread);
252
253 WinDestroyMsgQueue(hmq);
254 }
255 WinTerminate(hab);
256 }
257
258}
259
260static void contextMenu(HWND hwnd)
261{
262 POINTL ptl;
263 HWND hwndPopup;
264 HWND hwndTitleBar;
265 BOOL bVisible;
266
267 if((hwndTitleBar=WinWindowFromID(hwnd, FID_TITLEBAR))==NULLHANDLE)
268 return;
269
270 hwndPopup = WinLoadMenu(hwnd, RESSOURCEHANDLE, IDM_POPUP);
271 if (hwndPopup == NULLHANDLE)
272 return;
273
274 bVisible=WinIsWindowVisible(hwndTitleBar);
275
276 if(!bVisible)
277 WinSendMsg(hwndPopup,MM_SETITEMATTR,MPFROM2SHORT(IDM_ITEMTITLEBAR,FALSE),
278 MPFROM2SHORT(MIA_CHECKED,MIA_CHECKED));
279
280 WinQueryPointerPos(HWND_DESKTOP, &ptl) ;
281 WinMapWindowPoints(HWND_DESKTOP,hwnd,&ptl,1);
282 WinPopupMenu(hwnd, hwnd, hwndPopup,
283 ptl.x, ptl.y, IDM_ITEMEXIT, PU_HCONSTRAIN | PU_VCONSTRAIN |
284 PU_KEYBOARD | PU_MOUSEBUTTON1 | PU_MOUSEBUTTON2 | PU_NONE );
285}
286
287
288static BOOL toggleTitleBar(HWND hwnd)
289{
290 HWND hwndTitleBar;
291
292 if((hwndTitleBar=WinWindowFromID(hwnd, FID_TITLEBAR))!=NULLHANDLE)
293 {
294 SWP swp, swpFrame;
295
296 if(!WinQueryWindowPos(hwndTitleBar,&swp))
297 return FALSE;
298
299 if(!WinQueryWindowPos(hwnd,&swpFrame))
300 return FALSE;
301
302 /* Shrink or expand the frame */
303 if(!bTBVisible) {
304 WinSetWindowPos(hwnd, NULLHANDLE, swpFrame.x, swpFrame.y,//-swp.cy,
305 swpFrame.cx, swpFrame.cy+swp.cy, SWP_SIZE|SWP_MOVE);
306 bTBVisible=TRUE;
307 }
308 else
309 {
310 WinSetWindowPos(hwnd, NULLHANDLE, swpFrame.x, swpFrame.y,//+swp.cy,
311 swpFrame.cx, swpFrame.cy-swp.cy, SWP_SIZE|SWP_MOVE);
312 bTBVisible=FALSE;
313 }
314 }
315 WinSendMsg(hwnd,WM_UPDATEFRAME,0,0);
316 return TRUE;
317}
318
319
320/* This Proc handles the on-the-fly data CD writing */
321MRESULT EXPENTRY volumeDialogProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
322{
323 //char text[CCHMAXPATH*4 +10];
324 //char title[CCHMAXPATH*4];
325 HPOINTER hpProgramIcon; /* handle to program's icon */
326
327 switch (msg)
328 {
329 case WM_INITDLG:
330 {
331 RGB rgb;
332 ULONG ulSize;
333 SWP swp;
334 HWND hwndTB;
335 ULONG cy;
336
337 /*
338 * The slider control cannot be completely set from the dialog
339 * template so some aspects must be set here. We will set the
340 * volume range to 0-100, increment to 1-10, and the initial
341 * volume level to 75.
342 */
343 WinSendMsg( WinWindowFromID(hwnd, IDCS_VOLUME),
344 CSM_SETRANGE,
345 (MPARAM) 0L,
346 (MPARAM) 100L);
347
348 WinSendMsg( WinWindowFromID(hwnd, IDCS_VOLUME),
349 CSM_SETINCREMENT,
350 (MPARAM) 10L,
351 (MPARAM) 1L);
352
353
354 WinSendMsg( WinWindowFromID(hwnd, IDCS_VOLUME),
355 CSM_SETVALUE,
356 (MPARAM) queryMasterVolume(),
357 (MPARAM) NULL);
358
359
360 // getMessage(title, IDSTR_CONVERTCHANNELS, sizeof(title), RESSOURCEHANDLE, hwnd);
361 /* Set dialog font to WarpSans for Warp 4 and above */
362 if(SysQueryOSRelease()>=40) {
363 WinSetPresParam(hwnd,
364 PP_FONTNAMESIZE,(ULONG)sizeof(DEFAULT_DIALOG_FONT),
365 DEFAULT_DIALOG_FONT );
366 }
367
368 hpProgramIcon =
369 WinLoadPointer(
370 HWND_DESKTOP,
371 (HMODULE) NULL, /* Resource is kept in .Exe file. */
372 ID_ICONVOLUME ); /* Which icon to use. */
373
374 WinSendMsg(
375 hwnd, /* Dialog window handle. */
376 WM_SETICON, /* Message to the dialog. Set it's icon.*/
377 (MPARAM) hpProgramIcon,
378 (MPARAM) 0 ); /* mp2 no value. */
379#if 0
380 WinDefSecondaryWindowProc(
381 hwnd, /* Dialog window handle. */
382 WM_SETICON, /* Message to the dialog. Set it's icon.*/
383 (MPARAM) hpProgramIcon,
384 (MPARAM) 0 ); /* mp2 no value. */
385#endif
386
387 bTBVisible=IniRestoreInt(chrIniFile, INI_VOLUME_APP, INI_TBVISIBLE_KEY, 1);
388 // sprintf(text, ": %d", bTBVisible);
389 // WinMessageBox(HWND_DESKTOP, HWND_DESKTOP, text, "", 1234, MB_MOVEABLE);
390
391 IniRestoreWindowPos(chrIniFile, INI_VOLUME_APP, INI_WINDOWPOS_KEY, hwnd);
392 IniRestoreWindowClrs(chrIniFile, INI_VOLUME_APP , hwnd);
393
394 ulSize=sizeof(RGB);
395 if(IniRestoreData(chrIniFile, INI_VOLUME_APP, INI_BTNBGCLR_KEY, &rgb, &ulSize))
396 {
397 // Set the background colour
398 WinSetPresParam(WinWindowFromID(hwnd, IDPB_MUTE),
399 PP_BACKGROUNDCOLOR,(ULONG)sizeof(rgb), &rgb);
400 }
401 ulSize=sizeof(RGB);
402 if(IniRestoreData(chrIniFile, INI_VOLUME_APP, INI_BTNFGCLR_KEY, &rgb, &ulSize))
403 {
404 // Set the foreground colour
405 WinSetPresParam(WinWindowFromID(hwnd, IDPB_MUTE),
406 PP_FOREGROUNDCOLOR,(ULONG)sizeof(rgb), &rgb);
407 }
408 //#if 0
409 if(!bTBVisible)
410 {
411 /* Reduce size of dialog */
412 hwndTB=WinWindowFromID(hwnd, FID_TITLEBAR);
413
414 WinQueryWindowPos(hwndTB, &swp);
415 cy=swp.cy;
416 WinQueryWindowPos(hwnd, &swp);
417 WinSetWindowPos(hwnd, NULLHANDLE, 0, 0, swp.cx, swp.cy-cy, SWP_SIZE );
418 }
419 //#endif
420
421 WinShowWindow( hwnd, TRUE );
422 _beginthread(volumeThreadFunc,NULL,8192*16, NULLHANDLE); //Fehlerbehandlung fehlt
423 return (MRESULT) FALSE;
424 }
425
426 case WM_FORMATFRAME:
427 {
428 /* Remove top frame controls if titlebar is hidden */
429 SHORT countSwp;
430
431 countSwp = (int) WinDefDlgProc(hwnd, msg, mp1, mp2);
432 if(countSwp) {
433 if(bTBVisible==0) {
434 /* Hide frame controls */
435 /* countSWP: number of standard framecontrols
436 pswp: Array of SWP describing the framecontrols.
437 */
438 int a;
439 PSWP pswpTB=NULLHANDLE;
440 PSWP pswp=(PSWP)mp1;
441 int y, cy;
442
443 for (a = 0; a < countSwp; a++)
444 {
445 /* Find the titlebar window */
446 if ( WinQueryWindowUShort( pswp[a].hwnd, QWS_ID ) == FID_TITLEBAR )
447 {
448 pswpTB=&pswp[a];
449 y=pswp[a].y;
450 cy=pswp[a].cy;
451 // DosBeep(500,600);
452 break;
453 }
454 }
455
456 if(pswpTB) {
457 /* Hide all frame controls at the top */
458 for (a = 0; a < countSwp; a++)
459 {
460 if ( pswp[a].y == y )
461 {
462 pswp[a].fl|=SWP_HIDE;
463 pswp[a].fl&=~SWP_SHOW;
464 }
465 }/* for() */
466 /* Reduce size of dialog */
467 // WinQueryWindowPos(hwnd, &swp);
468 /*WinSetWindowPos(hwnd, NULLHANDLE, 0, 0, swp.cx, swp.cy-cy, SWP_SIZE );*/
469 // DosBeep(5000,600);
470 }
471 }
472 }
473 return MRFROMSHORT(countSwp);
474 }
475 case WM_CONTEXTMENU:
476 contextMenu(hwnd);
477 return (MRESULT) FALSE;
478 case WM_BUTTON1DBLCLK:
479 {
480 /* Remove frame controls (titlebar) when double clicking MB 1 */
481 toggleTitleBar(hwnd);
482 return (MRESULT) FALSE;
483 }
484 case WM_BUTTON2MOTIONSTART:
485 case WM_BUTTON1MOTIONSTART:
486 /* Drag the window without titlebar */
487 WinSendMsg(hwnd, WM_TRACKFRAME,
488 MPFROMSHORT(TF_MOVE /*| TF_SETPOINTERPOS */), NULL) ;
489 return (MRESULT) 0 ;
490 case WM_CONTROL:
491 if (SHORT1FROMMP(mp1)==IDCS_VOLUME)
492 {
493 if ((SHORT2FROMMP(mp1)==CSN_CHANGED) || /* change volume? */
494 (SHORT2FROMMP(mp1)==CSN_TRACKING)) /* tracking volume? */
495 {
496 SHORT sVolumeLevel;
497
498 sVolumeLevel = SHORT1FROMMP (mp2);
499 if(!bMute)
500 setMasterVolume(hwnd, sVolumeLevel);
501 }
502 }
503 else if (SHORT1FROMMP(mp1)==IDPB_MUTE)
504 {
505 if (SHORT2FROMMP(mp1)==GBN_BUTTONDOWN) {
506 bMute=TRUE;
507 setMasterVolume(hwnd, 0);
508 }
509 else if (SHORT2FROMMP(mp1)==GBN_BUTTONUP) {
510 SHORT sValue;
511
512 bMute=FALSE;
513 WinSendMsg(WinWindowFromID(hwnd, IDCS_VOLUME),CSM_QUERYVALUE ,MPFROMP(&sValue) ,0);
514 setMasterVolume(hwnd, sValue);
515 }
516 }
517 return( (MRESULT) 0);
518 case WM_CLOSE:
519 {
520 MCI_MASTERAUDIO_PARMS masteraudioparms;
521 ULONG attrFound;
522 RGB rgb;
523
524 memset(&masteraudioparms,0, sizeof(masteraudioparms));
525 /* Save master audio level */
526 mciSendCommand( 0,
527 MCI_MASTERAUDIO, /* Master audio message */
528 MCI_WAIT | MCI_MASTERVOL | MCI_SAVESETTING,
529 /* Flags for this message */
530 (PVOID) &masteraudioparms,
531 0);
532
533 WinPostMsg(hwndThread, WM_CLOSE, 0, 0);
534 /* Save window position */
535 IniSaveWindowPos(chrIniFile, INI_VOLUME_APP, INI_WINDOWPOS_KEY, hwnd);
536 /* Save titlebar state */
537 bTBVisible=WinIsWindowVisible(WinWindowFromID(hwnd, FID_TITLEBAR));
538 IniSaveInt(chrIniFile, INI_VOLUME_APP, INI_TBVISIBLE_KEY, bTBVisible);
539 /* Save colors */
540 // Query the current button background colour
541 if(WinQueryPresParam(WinWindowFromID(hwnd, IDPB_MUTE),
542 PP_BACKGROUNDCOLOR,0,&attrFound,sizeof(rgb),
543 &rgb,QPF_NOINHERIT))
544 {
545 IniSaveData(chrIniFile, INI_VOLUME_APP, INI_BTNBGCLR_KEY, &rgb, sizeof(RGB));
546 }
547 // Query the current button foreground colour
548 if(WinQueryPresParam(WinWindowFromID(hwnd, IDPB_MUTE),
549 PP_FOREGROUNDCOLOR,0,&attrFound,sizeof(rgb),
550 &rgb,QPF_NOINHERIT))
551 {
552 IniSaveData(chrIniFile, INI_VOLUME_APP, INI_BTNFGCLR_KEY, &rgb, sizeof(RGB));
553 }
554 IniSaveWindowClrs(chrIniFile, INI_VOLUME_APP , hwnd);
555 WinPostMsg(hwnd, WM_QUIT, 0, 0);
556 return (MRESULT )FALSE;
557 }
558 case WM_COMMAND:
559 switch(SHORT1FROMMP(mp1))
560 {
561 case IDM_ITEMTITLEBAR:
562 toggleTitleBar(hwnd);
563 break;
564 case IDM_ITEMEXIT:
565 WinPostMsg(hwnd, WM_CLOSE, 0, 0);/* Timer error so do a hard quit */
566 break;
567 default:
568 break;
569 }
570 return (MRESULT) FALSE;
571 default:
572 break;
573 }/* switch */
574 //return (MRESULT) WinDefSecondaryWindowProc( hwnd, msg, mp1, mp2 ) ;
575 return WinDefDlgProc( hwnd, msg, mp1, mp2);
576}
577
578
579int main (int argc, char *argv[])
580{
581 HAB hab;
582 HMQ hmq;
583 //char text[CCHMAXPATH];
584 //char title[CCHMAXPATH];
585
586 hab=WinInitialize(0);
587 if(hab) {
588 hmq=WinCreateMsgQueue(hab,0);
589 if(hmq) {
590
591 RESSOURCEHANDLE=queryResModuleHandle(argv[0]);
592
593 HlpBuildMMProgIniFileName(argv[0], chrIniFile, sizeof(chrIniFile));
594 bTBVisible=IniRestoreInt(chrIniFile, INI_VOLUME_APP, INI_TBVISIBLE_KEY, 1);
595
596 if( WinDlgBox( HWND_DESKTOP, NULLHANDLE,
597 volumeDialogProc, RESSOURCEHANDLE, IDDLG_VOLUME, 0) == DID_ERROR )
598 {
599 /*
600 Text:
601 Title: "Installation problem"
602 */
603#if 0
604 messageBox( text, IDSTR_CONVERTDIALOGERROR , sizeof(text),
605 title, IDSTR_INSTALLERRORTITLE , sizeof(title),
606 RESSOURCEHANDLE, HWND_DESKTOP, MB_OK | MB_ICONEXCLAMATION | MB_MOVEABLE);
607#endif
608 WinDestroyMsgQueue( hmq );
609 WinTerminate( hab );
610 DosBeep(100,600);
611 freeResHandle();
612 return( 1 );
613 }
614#if 0
615 hwndFrame=WinLoadSecondaryWindow(
616 HWND_DESKTOP, /* Parent of the dialog box. */
617 HWND_DESKTOP, /* Owner of the dialog box. */
618 (PFNWP) volumeDialogProc, /* */
619 (HMODULE) RESSOURCEHANDLE, /* */
620 IDDLG_VOLUME, /* Dialog ID. */
621 (PVOID) NULL); /* Creation */
622 hwndMainDialogBox = WinQuerySecondaryHWND(hwndFrame, QS_DIALOG);
623 WinShowWindow( hwndFrame, TRUE );
624 hpProgramIcon =
625 WinLoadPointer(
626 HWND_DESKTOP,
627 (HMODULE) NULL, /* Resource is kept in .Exe file. */
628 ID_ICONVOLUME ); /* Which icon to use. */
629 WinSendMsg(
630 hwndFrame, /* Dialog window handle. */
631 WM_SETICON, /* Message to the dialog. Set it's icon.*/
632 (MPARAM) hpProgramIcon,
633 (MPARAM) 0 ); /* mp2 no value. */
634 WinPostMsg( WinWindowFromID(hwndFrame, IDCS_VOLUME),
635 CSM_SETVALUE,
636 (MPARAM) queryMasterVolume(),
637 (MPARAM) NULL);
638 while ( WinGetMsg( hab, (PQMSG) &qmsg, (HWND) NULL, 0, 0) )
639 WinDispatchMsg( hab, (PQMSG) &qmsg );
640#endif
641 freeResHandle();
642 WinDestroyMsgQueue(hmq);
643 }
644 WinTerminate(hab);
645 }
646 return 0;
647}
648
649
650
651
652
653
654
655
656
657
658
659
Note: See TracBrowser for help on using the repository browser.