|
See here for the proper way to shut down a thread.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I have spent some days in exporting my Dialog Class in a MFC Dll,my dialog contains a gird control and toolbar control and some other controls. I can bulit the dll successfully ,but in the test code When I use the the following code :
CMyDialog dlg;
dlg.doModal();
The code just run the CMyDialog's constructor, doesn't invoke the OnCreat() and OnInitialDialog(),So My dialog cannot show up.
So I think the problem is about the Dll.
Does anybody can give me some suggestion or other helps!
Thanks a lot!
|
|
|
|
|
If the function where you call DoModal is also in that Dll you will need to declare AFX_MANAGE_STATE(AfxGetStaticModuleState());
at the beginning of that function!
|
|
|
|
|
How about the dll type? maybe in the extension dll ,there are some link errors.
|
|
|
|
|
hi,
in my project,it contains a main dialog and a child dialog which have some controls.now,i want to transparent the child dialog's background.
who can help me...
|
|
|
|
|
This is tricky, SetLayeredWindowAttributes() will make the whole dialog transparent, controls and all. There's no other way except for two ways I can think of. One is to make all your controls appear on windows the size of the control, communicating with them would be a little tedious.
You could also try painting a screen capture while you window is hidden, show the window and then paint itself with the screen capture. It will give it a transparent look. Look into the functions GetDC(), CreateCompatibleDC(), CreateCompatibleBitmap(), and BitBlt().
|
|
|
|
|
Hai..
I have a small problem, let me explain.
Suppose i have opened a file, name called d:\raghu\name.txt in the notepad application. Now i want to trace this path from my vc++ application. I have searched in the registry, but there is no use.
Please let me know.
Thanking you,
E.Veera Raghavendra.
|
|
|
|
|
Please alaborate. You wan't to know what file is open in NotePad.exe and you want to ???
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
I want to know the path of the file opened in the Notepad
e.veera raghavendra
|
|
|
|
|
See here and here for what you might be up against.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
It is actually harder than just that.
A filter driver on the file system(s) will allow you to capture open/close/read/write, etc. so you would be able to find out the LAST file that notepad had opened or created. The problem is that notepad does not hold the file handle open, it closes it after is reads it or saves the file. So, you would need to keep a list of PID's and "last opened" files. Of course, you would need to differentiate the file opened for "putting in notepad's window" verse opening some configuration file by some system component.
Even so, if you could solve that you would then need to clean the list of PID's so you don't keep growing them indefinately. This could again be solved by registering for process creation and destruction.
The final problem is that since notepad doesn't keep the file open, you can actually just select "New" and create a new untiled file without doing any disk access at all. So infact, notepad wouldn't have the file you previously opened in it anymore.
Now, here's a secret. There is a global variable in notepad called "notepad!szFileName". This is the file name that was opened. You would then just need to get notepad's current directory (Hopefully hasn't changed since the file was opened) and then relate it to reading this global variable from notepad's memory. If this global says "Untitled" then it's a new file.
So, how do you find the offset to this? Well you could simply hard code the offset based on a particular version of notepad, but the Microsoft symbol server has the symbols. So you could write a client that could then talk to the symbol server and request the PBD symbol file for that version of notepad, then read the offset into the file where it is and read the file name.
Alternatively, you could just "GetWindowText" and read the title bar of notepad. Of course this doesn't include the ".txt" extension if it's being used so "x.txt" and "x." look the same. Also, it includes no directory information so you're kind of stuck guessing where the file is on the system.
You could read the command line from the application, but then again you don't know if they've saved, closed the file and opened a new one. You could even hook "CreateFileW" in notepad, but you would never know if they used "new" and you also wouldn't tell the difference between when they are opening a file for editing or if some component is opening a file for settings or something else.
The moral of the story is that if you want to keep track of what file is being edited, why don't you just write your own editor.
8bc7c0ec02c0e404c0cc0680f7018827ebee
|
|
|
|
|
How do I use LockFileEx in C++ right after opening a file? Or is it better to use CFile operations?
Thanks!
|
|
|
|
|
(apologies if double post - I think I may have messed up)
If a PC has multiple NICs, with multiple protocol stacks (e.g. NOT just TCP/IP, but some have just IPX). I want to be able to iterate each NIC and get
1. its user given name (e.g. in XP it's called the "Network Connection" name)
2. Which protocol stack(s) are bound to it (e.g. TCP/IP, IPX, NetBios, et. al.)
3. Do this using C++ (MFC allowed, or just C with an API) on as many Windows OSes as possible (XP only is fine, but would like as many as possible
I have found the IPHelper API, but that is only good for adapters that have TCP/IP bound to them, but I definitely need it for NICs without TCP/IP bound to them, i.e. IPX (I am truly only concerned with IPX and TCP/IP - the other protocols really don't matter, but wouldn't mind being able to see them).
I have also found WSAEnumProtocols, which lets you iterate protocols across all NICs, but I cannot figure out how to map a specific protocol stack instance back to the specific NIC (specifically to its user assigned name and its IPX network number and/or IP address).
Why isn't there TAPI-like interface for network adapters? I can iterate TAPI devices based on their capabilities (data, voice, can make a call, et.al.). I have found nothing like this for Network Adapters (NICs) in Win32. Laptops especially are coming with multiple NICs (a wireless and a 10/100 base-T), so allowing users to specify "which network" to use is becoming more important.
Won't you please, please help me?!?
|
|
|
|
|
I don't know if this will help, I used it when I needed find the MAC address of the NIC card(s), from codeguru.
http://tinyurl.com/ae8gz
"An education isn't how much you have committed to memory, or even how much you know. It's being able to differentiate between what you do know and what you don't." - Anatole France
|
|
|
|
|
Ted,
I already saw this but the usable methods were protocol specific (e.g. TCP/IP or NetBios). Thanks for responding!
|
|
|
|
|
Having some problem to write a file transfer program thry bluetooth USB. Any idea using OBEX(Object Exchange) API protocol to initiate the server and client? Or better idea to write a file transfer program using Bluetooth USB. I using microsoft bluetooth protocol stack. To be precise - bluetooth APIs..Need some guidance to write the program with simple graphic user interface.
Thank you
Regards,
cheewooi
|
|
|
|
|
I wrote this little tool a while back that creates a raw socket and sends a custom UDP packet on it and it always worked great. But I tried it again, compiled it, and now when I run it I keep getting an error on my sendto() call and WSAGetLastError() returns error code 10004 which is supposed to be this:
WSAEINTR
(10004)
Interrupted function call.
A blocking operation was interrupted by a call to WSACancelBlockingCall.
Whatever that means.. I'm not using WSACancelBlockingCall anywhere, and my program isn't ending prematurely or anything. So I don't get it, why is it doing this all of a sudden?
Kuniva
--------------------------------------------
|
|
|
|
|
Hi!
I need your advice...
My MFC application loads one child dialog from dll.
All goes fine until i do not use keyboard
When i try to use it the dialog doesn't receive focus at all.
Well, i've overloaded the OnSetFocus() of a parent window to set the focus to my child dialog. Child dialog receives now focus, but after the next Tab it lose the focus (focus goes to the next control of the parent window, not child dlg).
How can i fix it?
|
|
|
|
|
ho. I got one question. Can you tell me how to do export a dialog from dll?
|
|
|
|
|
What did you mean?
To export dialog resource or what?
For example, if you just wanna create dialog window you can export some function like this:
HWND CreateMyDialog(HWND hwndParent)
{
HWND hWndDlg = CreateDialog( hInstDll,MAKEINTRESOURCE( IDD_OPTIONS_DLG ),
hwndParent, DlgProc );
return hWndDlg;
}
Where
hInstDll - handle to your dll (for example, you can pass it as the second parameter of the CreateMyDialog()).
DlgProc() - your dialog window procedure (it is in your dll too)
IDD_OPTIONS_DLG - dialog resource (also in your dll)
That is what I did...
PS: if you wanna use CDialog, then you can easily attach CDialog object in your application to any HWND, using CDialog::Attach();
That is what i did.
|
|
|
|
|
I mean I want to export the entire class ,ofcourse contain the resourece and the class. I think I have gotten some tips from your code. thanks
|
|
|
|
|
I need to determine whether or not a user profile is a mandatory profile (a read-only roaming profile). Unfortunately, a profile with a .man extension is not conclusive (this only means the profile was mandatory at some point, but may not be currently mandatory).
I think I need to get this information from the server but I don't know how to go about this.
Thanks!
-Ian
|
|
|
|
|
I am grasping for a solution here...
OK -- got an app with an embedded browser control (you know the IE one).
It updates with messages from our server -- but there's a problem. It clicks. Well, Windows issues a sound event when this updates.
And it's annoying.
Does anyone know of a way to disable the sound events associated with the IE control. I guess I wouldn't want to disable it globally -- just for my control.
Thanks in advance!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weijzen<br />
Staff Engineer<br />
<A HREF="http://www.santacruznetworks.com">Santa Cruz Networks</A>
|
|
|
|
|
While there's probably a better/cleaner solution, you might check the HKEY_CURRENT_USER\AppEvents\Schemes\Apps\Explorer\Navigating\.current registry key.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hey
Atm i'm working on a image processing project and i hit some snags. The interface of the program is created with MFC and GDI+, for the processing bit i created my own classes and functions and shoved them in one DLL. Since my classes and GDI+ have some similarities i tried to put my stuff in a namespace. So in stdafx.h i put the headers of the classes i want to import, in a namespace (implicit linking). This gives linker errors saying it cannot find certain functions. A solution would be to place all my code in a namespace already before compiling the dll. Is there a way around this, like that you choose between placing it in a namespace or not?
There is another strange thing. Apparently, when having this dll and calling for example 'bitmap = new Bitmap(..)', new returns NULL, while directly placing all my stuff in the project without the dll it works fine. Any thoughts on that?
|
|
|
|