Variable weitergeben

kleiner_muckefuck

Grünschnabel
Hi und schonmal danke das ihr das lest :),

habe mir hier etwas zusammengesucht und bin zu blöd eine schon fertig ausgelesene Variable in eine Api Funktion einzubauen weil ich ahnunglos bin was C++ angeht.

kurz beschrieben:
das programm test.exe bekommt die parameter z.B. '1024 768' und soll dann ein Fenster mit diesen Werten verändern....






#define WIN32_LEAN_AND_MEAN
#include <windows.h>

int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow )


{
char* szString = GetCommandLine();
MessageBox(NULL, szString, "", MB_OK); < hier zeigt er auch prima die Variablen z.B. 1024 und 768
MessageBox(NULL, lpCmdLine, "", MB_OK);



HWND hwnd = FindWindow(0, "Fenster");
if(!hwnd)


{
MessageBox(0,"Cannot find window!","Error", MB_OK);
}


else{



LONG lStyle = GetWindowLong(hwnd, GWL_STYLE);
SetWindowLong(hwnd, GWL_STYLE, lStyle&~(WS_CAPTION|WS_THICKFRAME|WS_MINIMIZEBOX) );
SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, SWP_FRAMECHANGED );
^^ da wo die beiden nullen sind sollen die Variablen hin


}
}

wäre gut wenn ihr da helfen könntet, hab schon probiert die Variable da einfach hinzusetzen wo die nullen sind aber das wird nichts...

danke schonmal Leute:)
 
Code:
else
	{
		char cx[5], cy[5];
		int tmp;
		tmp = (strchr(lpCmdLine, ' ') - lpCmdLine) + 1;
		lstrcpyn(cx, lpCmdLine, tmp);
		lstrcpyn(cy, &lpCmdLine[tmp], (lstrlen(lpCmdLine) - tmp) + 1);
		LONG lStyle = GetWindowLong(hwnd, GWL_STYLE);
		SetWindowLong(hwnd, GWL_STYLE, lStyle&~(WS_CAPTION|WS_THICKFRAME|WS_MINIMIZEBOX) );
		SetWindowPos(hwnd, HWND_TOP, 0, 0, atol(cx), atol(cy), SWP_FRAMECHANGED );
	}

versuch mal so...
 
danke danke !
es kommt noch die Fehlermeldung dass atol nicht deklariert ist, was muss ich da noch einbauen?
long atol( const char *); sowas ?

vielen Dank für die Hilfe :)
 
Zurück