dev.gamez.lv Forum Index dev.gamez.lv
Latvian Game Developers Community
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups 

WM_CLOSE komenteeshana...
Goto page Previous  1, 2
 
dev.gamez.lv Forum Index -> Programmēšana
View previous topic :: View next topic  
Author Message
bubu
Indago Uzvarētājs
Indago Uzvarētājs


Joined: 23 Mar 2004
Posts: 3223
Location: Riga

PostPosted: Tue Mar 22, 2005 11:06 pm    Post subject:

Angel wrote:
Nu jau man liekas ka es no cpp vairs nekaa nesaprotu. Tas taksh ir peec taas funkcijas Get..... Bet nu lab, apzinaos, ka no c++ saprotu maz (un ar katru miilju briidi veel mazaak... )
Koda kārtība failā nebūt nenorāda tā izpildes kārtību:
Code:
void a() {
  // ...
}

void b() {
 // ...
}

int main() {
  b(); // izpilda b() fju pirms a() fjas
  a();
}
Back to top
View user's profile Send e-mail
elvman
Indago Uzvarētājs
Indago Uzvarētājs


Joined: 09 Apr 2003
Posts: 1278
Location: Kuldiga

PostPosted: Wed Mar 23, 2005 4:18 pm    Post subject:

Tev manupraat vajadzeetu dariit sekojosji:

case WM_CLOSE:
if (IsWindow(window->hWnd)) DestroyWindow(window->hWnd);
break;

jo ja tu nospied X tad MS Windows logu automaatiski Destroy'o.
_________________
long time; /* know C */
Back to top
View user's profile Visit poster's website
bubu
Indago Uzvarētājs
Indago Uzvarētājs


Joined: 23 Mar 2004
Posts: 3223
Location: Riga

PostPosted: Wed Mar 23, 2005 4:23 pm    Post subject:

elvman, da viņam window ir NULL, kāds tur vēl window->hWnd !?!
Back to top
View user's profile Send e-mail
elvman
Indago Uzvarētājs
Indago Uzvarētājs


Joined: 09 Apr 2003
Posts: 1278
Location: Kuldiga

PostPosted: Wed Mar 23, 2005 4:29 pm    Post subject:

Es to if (IsWindow(window->hWnd)) DestroyWindow(window->hWnd); uzrakstiju tikai taadeelj lai vinsh pats redzeetu kaa tas viss straadaa un lai vareetu to izmantot kaukur citur. Es tachu zinu ka window->hWnd ir NULL.
_________________
long time; /* know C */
Back to top
View user's profile Visit poster's website
elvman
Indago Uzvarētājs
Indago Uzvarētājs


Joined: 09 Apr 2003
Posts: 1278
Location: Kuldiga

PostPosted: Wed Mar 23, 2005 4:31 pm    Post subject:

Ez kauko mazliet laikam nesapratu.
Vinjam window ir NULL?

Nu tad neko.
_________________
long time; /* know C */
Back to top
View user's profile Visit poster's website
anggelus



Joined: 23 Feb 2005
Posts: 383
Location: Rīga (LV)

PostPosted: Wed Mar 23, 2005 4:56 pm    Post subject:

Code:

LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){
   sWindow* window = (sWindow*)(GetWindowLong(hWnd,GWL_USERDATA));

   switch(uMsg){

/*   case WM_CLOSE:
      DestroyWindow(window->hWnd);
      break;*/
   case WM_DESTROY:
      PostQuitMessage(0);
      break;
   default:
      return DefWindowProc(hWnd, uMsg, wParam, lParam);
   }
   return 0;

}


Shitas tev nemuuzham nestraadaas. Palasi MSDN helpaa ko dara funkcija GetWindowLong().
"If SetWindowLong has not been called previously, GetWindowLong returns zero for values in the extra window or class memory."
Kaapeec gan tev vajag window->hWnd ja noraade uz logu jau dota WndProc() parametros???

Shitam vajadzeetu straadaat ,be nekaadiem GetWindowLong():
Code:

LRESULT CALLBACK WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam){
   switch(uMsg){

   case WM_CLOSE:
      if(hWnd)
           DestroyWindow(hWnd);
      break;
   case WM_DESTROY:
      PostQuitMessage(0);
      break;
   default:
      return DefWindowProc(hWnd, uMsg, wParam, lParam);
   }
   return 0;

}

_________________
No comprendo lo que dice.
Back to top
View user's profile Send e-mail
elvman
Indago Uzvarētājs
Indago Uzvarētājs


Joined: 09 Apr 2003
Posts: 1278
Location: Kuldiga

PostPosted: Wed Mar 23, 2005 4:59 pm    Post subject:

Nu jaa tas buutu tas pats. Bet galvenais lai vareetu saprast ideju.
_________________
long time; /* know C */
Back to top
View user's profile Visit poster's website
Angel



Joined: 02 Jan 2005
Posts: 113
Location: Latvija

PostPosted: Wed Mar 23, 2005 5:37 pm    Post subject:

Liels jums paldies ieboreejaat arii manaas smadzenees saprašanu par vairākām tēmām(jau).
Man to vajadzeeja dariit jo ir doma, ka struktuurā Windows atradiisies ne tikai tas, bet taustiņu stāvoklis u.t.t.
Bet ja es pēc Create Window Pārbaudu vai hWnd nav NULL, tad jau es noteikti zinu, ka logs ir izveidots. Tas atkal nozīmē, ka var iztikt bez WM_CREATE un CREATESTRUCT* vai tomēr es kļūdos Question
Back to top
View user's profile Send e-mail
anggelus



Joined: 23 Feb 2005
Posts: 383
Location: Rīga (LV)

PostPosted: Wed Mar 23, 2005 5:58 pm    Post subject:

Var iztikt bez WM_CREATE, var iztikt arii bez WM_CLOSE un WM_DESTROY. Tas viss ir domaats lai papildinātu logu ar dazhaadaam iespeejaam, par visu minimaalo kas nepiecieshams, lai logs paraadiitos paruupeejas DefWindowProc();
_________________
No comprendo lo que dice.
Back to top
View user's profile Send e-mail
Display posts from previous:   
dev.gamez.lv Forum Index -> Programmēšana All times are GMT + 2 Hours
Goto page Previous  1, 2
Page 2 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group