ورود

View Full Version : سوال: این دوخط چیکار می کنن؟



darknes666
جمعه 13 اردیبهشت 1392, 22:07 عصر
اولین سوالم اینه تو این دستور
HWND hwnd;
دقیقا یعنی چی من نتونسم بفهمم فقط فک کنم یک جور متغیر هست.
دومیشم این دستور هست
AllocConsole();
اینو کلا نمیدونم چی کار میکنه.
دوستان دستور اولی رو لطف کنین کامل توضیح بدین ممنون.

Ananas
جمعه 13 اردیبهشت 1392, 22:45 عصر
تو کد مذکور یک متغیر از نوع HWND تعریف شده. منظور از H عبارت Handle و WND همWindow هست. "دستگیره ای به یک پنجره" . متغیر یک عدد هست مثل اشاره گر و برای استفاده از تابع های ویندوز به این هندل احتیاج دارید. جزو ورودی های تابع های ویندوز استفاده میشه و تو برنامه نویس ویندوز هر پنجره، یک هندل داره که از طریق اون به پنجره دسترسی دارید و می تونید باهاش کار کنید.

darknes666
شنبه 14 اردیبهشت 1392, 13:55 عصر
خیلی ممنون دوست عزیز.اما دستور دومی چی؟

Ananas
شنبه 14 اردیبهشت 1392, 14:39 عصر
نمیدونم ولی این هلپ c++builder هست:

AllocConsole


Allocates a new console for the calling process.
BOOL WINAPI AllocConsole(void); Parameters

This function has no parameters. Return Value

If the function succeeds, the return value is nonzero.
If the function fails, the return value is zero. To get extended error information, call GetLastError.
Remarks

A process can be associated with only one console, so the AllocConsole function fails if the calling process already has a console. A process can use the FreeConsole (http://barnamenevis.org/freeconsole.htm) function to detach itself from its current console, then it can call AllocConsole to create a new console or AttachConsole (http://barnamenevis.org/attachconsole.htm) to attach to another console.
If the calling process creates a child process, the child inherits the new console.
AllocConsole initializes standard input, standard output, and standard error handles for the new console. The standard input handle is a handle to the console's input buffer, and the standard output and standard error handles are handles to the console's screen buffer. To retrieve these handles, use the GetStdHandle (http://barnamenevis.org/getstdhandle.htm) function.
This function is primarily used by graphical user interface (GUI) application to create a console window. GUI applications are initialized without a console. Console applications are initialized with a console, unless they are created as detached processes (by calling the CreateProcess (http://barnamenevis.org/createprocess.htm) function with the DETACHED_PROCESS flag).