|
baerten wrote: WM_NEXTDLGCTL in a universal function, which sets only
the focus on the next control, wherever the control is placed.
Well for testing purpose, I put this event call in a timer
void OnTimer( UINT Id )
{
PostMessage( WM_NEXTDLGCTL, FALSE, FALSE );
}
Works well for me, focus shifts properly around all controls in the dialog. Then I put it in a button event handler, after this the focus always moved to the Cancel button, guess why? So you need to watch out for such issues.
A wild guess! Are you posting WM_NEXTDLGCTL twice, since it's a post message you wouldn't know, a suggestion would be replace PostMessage with SendMessage (MSDN says don't) for testing purpose to find out where if at all a duplicate one is being posted, since it blocks. Don't forget to revert back to PostMessage .
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
modified on Tuesday, June 24, 2008 8:00 AM
|
|
|
|
|
Hi. I am programming c++ with MFC on VS2005. I was wondering how you can make your application draw outside its own window.
There are softwares out there that allow a user to scribble anything on the computer screen over any applications that are running or the desktop. A couple of them are
ActivePen (http://www.kongda.com/products/activepen/default.asp),
VBDoodle (http://www.hopkinsprogramming.net/software/vbdoodle/gallery/)
Draw-On-Screen (http://downloads.zdnet.com/abstract.aspx?docid=352162)
My question is how would I replicate this behavior? Im new to visual c++, and although i have experimented with making my own version of paint, I was only able to draw inside the screen of my MFC application which was made using Edit view class as base class. Did not see any way to draw just anywhere on the screen outside the window.
It would be great if you could maybe name a few built in classes/methods that can do this, or provide me with a link to a known resource on this topic. Thank you.
|
|
|
|
|
If you are using MFC, you can use CWindowDC dc(0); to get a device conext to entire screen. Other wise use GetDC(0) to get the dc to entire screen.
Any drawing to the above dc's will come in screen at the specified locations.
|
|
|
|
|
On similar lines as the answer you received above you can get a dc for the desktop window HWND. The desktop window hwnd can be obtained by GetDesktopWindow API
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
|
Thanks a lot jijo. The article you have linked me to is just what i needed.
|
|
|
|
|
garyofcourse wrote: Thanks a lot jijo.
Always Welcome!
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
Hi All,
We have quite about 30 clients connecting to about 200 servers on our WAN. Currently we are experiencing extremely slow connection establishment times, in the order of 15-20 seconds. However, a ping from a client to the same server responds in 1-2 seconds.
The client and server applications are based on WSASocket.
I have traced the client and server side applications to death and it seams that the delay is in the receiving of the FD_ACCEPT event. Once the event has been received and the connections established, all seems fine, but it takes an unusually long time for the event to be received (through WSAEnumNetworkEvents).
Are there any reasons for the connection establishment to take SOOOO long, while a ping goes through quite quickly ?
Thanks
OD
|
|
|
|
|
Sounds strange, maybe your routers do some traffic shaping or you hit a bottleneck in your network infrastructure. I would try to send more dummy data with the connection handshake (to see if that has a negative or positive impact), plus try another listening port number.
/M
|
|
|
|
|
I can't start the MDI application by dbclick a data file.
It reports that the file can't be found, and crashes.
I check the registry, and found:
open
|
|---command
| Default d:\myapp.exe /dde
|---ddeexec
Default [open("%1")]
I tried to change it as below:
open
|
|---command
Default d:\myapp.exe "%1"
the problem is solved, but when I open a data file the second time, the registry is restored automatically.
What's dde? How to make it correct?
|
|
|
|
|
HANDLE hToken;
if(!GetTokenByName(hToken,"EXPLORER.EXE"))
{
return FALSE;
}
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(STARTUPINFO));
si.cb= sizeof(STARTUPINFO);
si.lpDesktop = TEXT("winsta0\\default");
BOOL bResult = CreateProcessAsUser(hToken,"D:\\1.bat",NULL,NULL,NULL, FALSE,NORMAL_PRIORITY_CLASS,NULL,lpCurrentDir,&si,&pi);
I use CreateProcessAsUser run 1.bat attach a database to sql server 2000.
1.bat:
OSQL -E -Q "sp_attach_db @dbname = 'YDJC2', @filename1 = '%CD%\database 08-6-5\YDJC2_Data.MDF', @filename2 = '%CD%\database 08-6-5\YDJC2_Log.LDF'"
But, this database is read only attribute in sql server 2000, why?
I double click mouse button to run 1.bat is OK, database is read/write attribute in sql server 2000.
How to use CreateProcessAsUser to solve this problem?
|
|
|
|
|
Dear All,
I want to develop an application in VC++ as dll. Please tell me whether it is possible to access the dll from a C# GUI application. For example, I have 5 dll for five different application. In the C# GUI I have 5 buttons, clicking the button has to launch the application (dll) accordingly.
I dont know how to develop this kind of application and also dont know whether this is possible or not.
|
|
|
|
|
bhanu_8509 wrote: For example, I have 5 dll for five different application. In the C# GUI I have 5 buttons, clicking the button has to launch the application (dll) accordingly.
A dll is not an executable, so you can't "execute" a dll. Why don't you simply make 5 executables that you can start from C# ? I don't really understand why you want to use dll's. Or I misunderstood your question, and then some more information would be useful.
|
|
|
|
|
Please kindly refer my reply.
|
|
|
|
|
Do you wan to make your dlls on the c++ and use of them on the C#? yes
|
|
|
|
|
>>For example, I have 5 dll for five different application?
What kind of applications are these??
You can export functions from a dll and then on every button click, you can call any function inside any dll. So, it is possible for you to make five dll and make each dlls export 1 function which you will call depending on which button is clicked.
the fruits of your success will be in direct ratio to the honesty and sincerity of your own efforts in keeping your own records, doing your own thinking and, reaching your own conclusions.
..surviving in autumn..in love with spring..
|
|
|
|
|
My application is for MPEG2 Transport Stream Analysis and Decoding of MPEG streams. I am developing this applications in vc++.
theCPkid wrote: You can export functions from a dll and then on every button click, you can call any function inside any dll. So, it is possible for you to make five dll and make each dlls export 1 function which you will call depending on which button is clicked.
My dll has many functions with it, for example, I will develop the decoder as one dll. Please tell me is it possible to call the dll from the c# GUI application. Does it takes more memory during the init of the c# application ? Can we control all the functions in the dll from the c# app ?
Also advice whether to develop the decoder app as a executable and then call the exe from the c# app. Will this takes more memory while loading ?
Please kindly advice how to proceed (whether to use dll or exe).
Thank you very much. Expecting your kind reply
modified on Tuesday, June 24, 2008 7:18 AM
|
|
|
|
|
Can anyone help me for the above ?
Kindly,
Gaja
|
|
|
|
|
DLLs are more efficient when it comes to memory usage.
See this link:
http://msdn.microsoft.com/en-us/library/dtba4t8b(VS.80).aspx
Your dll can export as many functions as it wants.
What do you mean by controlling a function? You call the function inside you dll and it will accept some input, transport stream, and gives back audio/video stream as output.
By the way, it does not matter right now whether you work on dll or exe as the decoding logic will remain same. So, you can start working on it till you get a better idea of it.
Good Luck.
the fruits of your success will be in direct ratio to the honesty and sincerity of your own efforts in keeping your own records, doing your own thinking and, reaching your own conclusions.
..surviving in autumn..in love with spring..
|
|
|
|
|
Thank you very much for your reply. I have finished developing the application as MFC. Now I have MFC executable. But now I need to design a single GUI to control all the functions.
I dont develop the application as dll as of now it is available only as MFC executable. I also go through the VC++ windows application forms and found it is better for designing GUI.
Now my question is that, "Is it possible to migrate the VC++ MFC code into Windows application form". It will be very easy for me, if the above one is possible.
Please guide me. (I am only having little knowledge in Windows application forms. If I am not explaining you correctly means, please advice.)
Many thanks in advance.
|
|
|
|
|
oh! I am sorry for the very late reply.
"Is it possible to migrate the VC++ MFC code into Windows application form"
> No. AFAIK, you cannot directly copy MFC code into C#. You will need to make significant changes as the two languages are different.
But you have no trouble. Just create a dll. For that, create an empty MFC dll using wizard, and then copy your mainframe, view and doc class (assuming you are using doc/view architecture in MFC application) directly into dll and write the functions you want to export in the one cpp file of dll created by wizard.
You wont need to do any changes in code to create dll. and then you can use this dll in your C# application.
Hope that helps.
the fruits of your success will be in direct ratio to the honesty and sincerity of your own efforts in keeping your own records, doing your own thinking and, reaching your own conclusions.
..surviving in autumn..in love with spring..
|
|
|
|
|
I am using IActiveDesktop:SetWallpaper function to set the wallpaper. My application generates a bitmap, say D:\image.bmp and then this image is set as wallpaper. The problem is when I edit this image.bmp and call set wallpaper again, the new picture is internally set but is not updated on desktop. I mean to display the new edited picture I need to go to properties->Desktop and then ask windows to load image again.
Is there any way to programmatically tell windows to reload the wallpaper image. I guess it just assumes that if path is same, then no need to reload the image?
the fruits of your success will be in direct ratio to the honesty and sincerity of your own efforts in keeping your own records, doing your own thinking and, reaching your own conclusions.
..surviving in autumn..in love with spring..
|
|
|
|
|
|
Hey, thanks for the useful link. The link you have given will be helpful to me in many other ways although the problem I had can be solved by passing AD_APPLY_FORCE flag to ApplyChanges function of IActiveDesktop interface. I was using AD_APPLY_ALL but it was not refreshing the desktop.
the fruits of your success will be in direct ratio to the honesty and sincerity of your own efforts in keeping your own records, doing your own thinking and, reaching your own conclusions.
..surviving in autumn..in love with spring..
|
|
|
|
|
I glad my answer was helpful for you.
|
|
|
|