|
How can i replace the standart window class name for dialog window, given by MFC (#32770) with my one?
|
|
|
|
|
That is the standard name of the dialog class given by windows.
All that you have to do is subclass the dialog with SetWindowLong.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
First of all, unless you want to change some specific behavior for all dialogs, why would you want to do that?
I don't quite remember (long time since I did this) but you have to register a new class, with a new window procedure (which pases unhandled messages to DefDlgProc instead of DefWindowProc), and a cbWndExtra value of DLGWINDOWEXTRA (30 bytes last time I checked.)
Also you must add a CLASS statement to the dialog box template in the RC file.
Then you can use CreateDialog or DialogBox to display the dialog.
(Ok, everything here was SDK instructions, but not difficult to translate to MFC)
-- LuisR
──────────────
Luis Alonso Ramos
Chihuahua, Mexico
www.luisalonsoramos.com
CPUA: 0xC0DE - No Sonork yet
MiniPutt best: 20
"Do not worry about your difficulties in mathematics, I assure you that mine are greater." -- Albert Einstein
|
|
|
|
|
I want to do that because there is a requirement an other program to take a handle to my window. This is done with FindWindow function. The inconvenience is, that there may be an other dialog windows, and FindWindow find out one of them. I need my window class to be unique.
I solved the problem. I have not written a new dialog procedure, only obtain a class info with GetClassInfo function for #32770 and replace the name with my own. Then i registered the new class, and added a CLASS statement into .rc-file. Thank you!
|
|
|
|
|
Hi,
I'm using Visual Studio .Net for my project. When I create the exe and run it on a 2K system. It tells me I am missing msvcrt70.dll. After debugging it, I found that it happens when I call LoadLibrary. My question is why does LoadLibrary depend on this file and is there a way to remove the dependancy?
-Thanks
|
|
|
|
|
No, you simply need this file as your program uses some of its functions. You have to distribute it along with your program, the other solution is to write application without use of MFC (i am not familiar with .net, so i dont know if that is possible (it should be)), but i guess you dont want that either .
|
|
|
|
|
I'm not using MFC. Anyway, I figured out why it was dependant on it and was able to remove the dependancy.
Thanks
|
|
|
|
|
Hi!Tell me,please,how can I put Wallpaper(background)in to the view of my project and what type of file it must be (.bmp or ...)
Thank you very much!
|
|
|
|
|
You have to handle WM_ERASEBKGND .
Irina.T wrote:
what type of file it must be (.bmp or ...)
I don't think there is limitation for it.
Mazy
"The path you tread is narrow and the drop is shear and very high,
The ravens all are watching from a vantage point near by,
Apprehension creeping like a choo-train uo your spine,
Will the tightrope reach the end;will the final cuplet rhyme?"Cymbaline-Pink Floyd
|
|
|
|
|
Handle the WM_ERASEBKGND message sent the view.
the wParam will contain an HDC if you are programming with the SDK, or the OnEraseBkGnd function will have an HDC that you should use to paint on.
You will be able to use any format that you can find or write code to load into an HBITMAP object. Try searching this site, there are a number of utilities to help with image loading.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
suppose i begin two threads in my process by _beginthread(),now i wanna terminate one thread from another,how shall i?(i dont wanna use MFC)
thanks
It's a good day today
|
|
|
|
|
How are you synchronizing between your two threads?
I would create an event and have the second thread periodically check for that event to be set, then terminate itself with a call to _endthread .
Or if you have a MessagePump, you could also send a message to that thread informing it that it should shut down. In order to send a message to another thread you need to use PostThreadMessage .
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Thanks.
In fact i am writting for my homework--transfer files by TFTP protocol.The two threads,one is used to receive data packet,the other serves as a timer.If the first thread has been waiting for too long a time,the 2nd shall timeout and abort the first one.So will event still work in this case?Because before data packet arrives,the first one just stop there,waiting;so it perhaps can not periodically check messages.
The other problem is that i write my program in C,but i notice that PostThreadMessage is a method of a class CWinThread.Are there other ways?
God blessing me...
|
|
|
|
|
Look again at your documentation: there's a C only version of PostThreadMessage (the MFC is merely a wrapper around this.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi.
I have a dialog box. When Windows draws the dialog box, I want to to focus to a specific CEdit object (window). For example, let say the dialog box asks the user for a username and password. I would like Windows to focus the username window when it first draws the dialog box.
What is the best way to do that?
Thanks,
Kuphryn
|
|
|
|
|
use SetFocus() in OnInitDialog() , and return FALSE .
--------
And we die young.
Faster we run. Alice in Chains, We Die Young
|
|
|
|
|
If you don't want to set focus programatically (i.e. if the edit control will always have focus), just set it to be first in the dialog's tab order.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Thanks.
I presume the coding technique applies to modal dialog box and modeless dialog box.
Kuphryn
|
|
|
|
|
Thanks.
I saw at least two responses about overriding OnInitDialog().
Here is the solution:
...OnInitDialog()
{
...
GetDlgItem(the CEdit window's ID)->SetFocus();
...
return FALSE;
}
Kuphryn
|
|
|
|
|
I've read an article but this use a ReBar so i don't need that the rebar to be docckable, i need only the toolbars, and controlbars, does anybodi know how?
|
|
|
|
|
Hi all,
I have a question on closing window. I have obtained a third party dll that pops up a window at the end of using it. Therefore, I would like to know how to write a program that uses this dll, and kill that popup window automatically without any user input.
Thanks,
Sunny
|
|
|
|
|
MyWindow.DestroyWindow();
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"But there isn't a whole lot out there that pisses me off more than someone leaving my code looking like they leaned on the keyboard and prayed that it would compile.
- Jamie Hale, 17/4/2002
|
|
|
|
|
Have you tried sending it WM_CLOSE ? Otherwise, DestroyWindow() should do it.
--------
And we die young.
Faster we run. Alice in Chains, We Die Young
|
|
|
|
|
LPNMTREEVIEW itemOld
Is there a command within MFC to obtain the Old Item from the WM_NOTIFY message.
GetSelectedItem provides the New Item, is there an equivalent for the Old Item.
Sara
|
|
|
|
|
??? It is given as a member of the NMTREEVIEW structure for those messages that use it. This structure is passed to your notification handler in MFC; you just need to cast the NMHDR ptr to it.
--------
And we die young.
Faster we run. Alice in Chains, We Die Young
|
|
|
|