|
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.
|
|
|
|
|
|
IActiveDesktop::ApplyChanges( AD_APPLY_ALL ) alone wont do. You need to pass AD_APPLY_FORCE function to refresh the same picture. AD_APPLY_ALL do not include AD_APPLY_FORCE. Thanks for your reply.
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..
|
|
|
|
|
ooh! Thanks for the info!
Regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
In the main window callback function I get the WM_KILLFOCUS message when I click on the window, and only then I get the WM_SETFOCUS message.
Is that OK?
I thought that WM_KILLFOCUS message is sent to a window immediatly before it looses focus.
I want to register some values when the window has keyboard focus and unregister the values when the window looses focus.
How can I do that?
danginkgo
|
|
|
|
|
do you have child controls on your main window??
Regards,
Sandip.
|
|
|
|
|
I have child controls on the main window.
danginkgo
|
|
|
|
|
then probably WM_KILLFOCUS is for one of the child window which was having focus earlier.
Check the vlaue of wParam in WM_KILLFOCUS. It is a handle to new window which will get the focus.
You can verify that WM_KILLFOCUS was not for your main window by comparing wParam with your main window handle.
And to find which window lost the focus check value of wParam in WM_SETFOCUS.
Regards,
Sandip.
|
|
|
|
|
OK, but if the main window loses focus, doesn't it get the WM_KILLFOCUS message? I just have to unregister some hotkeys if the window loses focus. How can I do that?
danginkgo
|
|
|
|
|
How can I know when the main window loses focus?
danginkgo
|
|
|
|