Hi Hassan, by the time I read your message I'd made a start on implementing a modeless window. I had a good look through the link you gave me by Mista. Very long piece of code. :-(
I started out approx 20 years ago on the Atari and Amiga 68000 asm and C programming. I've done odd and sods of windows api and stuck with basic for years. C++ amd classess put me back.
Getting back into it because of the Dark GDK C seems to be strong as usual. The windows api programming is just like any libraries you build up yourself over time. There's tons of resources out there I've looked through and found them invaluable. Sometimes I feel like a noob all over again but its sinking in.
I have found that everything has to be stuck inside the main loop in a GDK api apart from initialising code but that ain't a problem. Just getting the message handling to work now on a modeless dialogue while the 3D is still running in the background. I may have to setup some kind of timer function just in case I can't handle all the windows messages.
"winapistuff.h"
static BOOL CALLBACK myDialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
if (WM_INITDIALOG == message)
{
return FALSE;
}
switch (message)
{
case WM_COMMAND:
switch (LOWORD(wParam))
{
case IDC_BUTTON1:
app_pause=TRUE;
return TRUE;
case IDC_BUTTON2:
app_pause=FALSE;
return TRUE;
}
break;
}
return FALSE;
}
"Main.cpp"
#include "DarkGDK.h"
#include "resource.h"
int app_pause=FALSE;
#include "winapistuff.h"
// the main entry point for the application is this function
void DarkGDK ( void )
{
float angleX=0.00, angleY=0.00, angleZ=0.00;
float anginX=1.03, anginY=0.87, anginZ=1.21;
HWND mydialog=NULL;
if (mydialog=CreateDialog(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIALOG1),NULL,myDialogProc))
{
ShowWindow(mydialog, SW_SHOW);
// at this point I can allow the App run on (not yet though)
}
dbSyncOn ( );
dbSyncRate ( 60 );
dbMakeObjectCube(1,10);
while ( LoopGDK ( ) )
{
if (app_pause==FALSE)
{
dbRotateObject(1,angleX,angleY,angleZ);
angleX=dbWrapValue(angleX+anginX);
angleY=dbWrapValue(angleY+anginY);
angleZ=dbWrapValue(angleZ+anginZ);
}
dbSync ( );
}
// return back to windows
return;
}
So far this will open a modeless dialogue (I'm hoping I've done everything right). It has two buttons on it, "Pause" and "Continue". As you can see in the winapistuff.h file, the global variable "app_pause" is set to TRUE or FALSE on a click of a buttong in the dialogue.
Currently here I am unsure yet where to put in my code the TranslateMessage and DispatchMessage calls.
Has anyone got any pointers as to were I am upto...
Warning! May contain Nuts!