|
No, he was giving you some suggestions.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Rajesh R Subramanian wrote: No, he was giving you some suggestions.
Maxwell Chen
|
|
|
|
|
Thanks for the tip Maxwell 
|
|
|
|
|
|
I have a dialog based application that I would like to convert to a
SDI/MDI architecture.
Please help me out to resolve the above problem.
Thanks in advance.
Mallikarjun
|
|
|
|
|
You can do that manually by converting dialog to doc-view based SDI/MDI app by creating new Doc,View,Frame files and integrating the logic in there and doing lots of other things. But that would be very cryptic because there are very meticulous things to be done in order to achieve it.(e.g. manually editing RC to create frames, menu, toolbar and all).
I think instead of tweaking same app from dlg based to SDI/MSI, it'd be better if you create a fresh MDI/SDI app and then port the functionality one by one from your dialog based app to the SDI/MDI app.
Regards
Cage
|
|
|
|
|
lavate malllik wrote: Please help me out to resolve the above problem.
Well if you implemented any sort of Design using Best Practices and Patterns it should be very simple rote work to replace the UI with another. Of course you have to actually develop the UI which may not be simple at all.
led mike
|
|
|
|
|
In my app, I applied SetMapMode() to CView's DC for zoom in-out purpose, drawing (such as LineTo()) and bitmap (such as StretchBlt()) are changed properly with zoom's change.
Problem is that text size (such as by TextOut()) keeps the same even zoom is changed.
Do you know how to change text size automatically when zoom is changed? -- do not use SetFont() or similar functions to change font size.
thx
|
|
|
|
|
|
As I tested, the function can not change text size.
|
|
|
|
|
Friends,
I want to launch command prompt window from my application running on Windows Vista. For this purpose i am using CreateProcess. What i want is that command prompt window shoul be launched with Administrative priviliges. Please tell me how can i do so ?
Imtiaz
|
|
|
|
|
I'm not sure about CreateProcess().
But maybe this:
::ShellExecute(NULL, _T("runas"), _T("c:\\Windows\\System32\\cmd.exe"), _T(""), _T(""), SW_SHOWNORMAL);
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Not counting the run as administrator part, I'd do it like this:
#include "stdafx.h"
#include <windows.h>
#include <tchar.h>
#include <shellapi.h>
#include <malloc.h>
#pragma comment(lib, "shell32.lib")
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
DWORD size = GetEnvironmentVariable(_T("ComSpec"), NULL, 0);
LPTSTR pPath = static_cast<LPTSTR>(_alloca(size*sizeof(TCHAR)));
GetEnvironmentVariable(_T("ComSpec"), pPath, size);
ShellExecute(NULL, NULL, pPath, NULL, NULL, SW_SHOWNORMAL);
return 0;
}
This code makes no assumptions about the location of the windows folder or the location and name of the command interpreter.
Steve
modified on Wednesday, March 5, 2008 10:08 PM
|
|
|
|
|
Sweet! Thanks for that!!
Just add the runas verb and it will prompt for elevation...
ShellExecute(NULL, _T("runas"), pPath, NULL, NULL, SW_SHOWNORMAL);
Filed for future reference, thanks!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
In addition to Mark's reply, see here[^].
Steve
|
|
|
|
|
Imtiaz Murtaza wrote: For this purpose i am using CreateProcess. What i want is that command prompt window shoul be launched with Administrative priviliges
have a look at CreateProcessWithLogon, CreateProcessWithToken, CreateProcessAsUser.
|
|
|
|
|
I would really like to use CWinThread class.
I have an odd situation where i am in a dll and would like to use a thread. For come reason CWinThread is not accessible here.
When i try to inclde afxwin.h before my stdafx.h
I would not compile on :
CWinThread *pThread;
I get the following errors
error C2143: syntax error: missing ';' before'*'
error C2501: 'CWinThread':missing storage-class or type specifiers.
Any idea what is going on here?
|
|
|
|
|
Maybe there is something in my 'properties' that i am missing ?? 
|
|
|
|
|
Why not include afxwin.h IN stdafx.h?
Build a quick temporary MFC project with the project wizard and you'll see a working arrangement
for the MFC header files.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Have the same problem if i include afxwin.h IN stdafx.h
Could it be that my .dll is a win32 and cannot run MFC classes?
|
|
|
|
|
How would i get around this using a Win32 dll trying to implement an MFC class like CwinThread? If this is not possible, what are my thread options. I am simply creating a waitable timer but wanted to do this in a thread.
thanks,
|
|
|
|
|
If all you are using is CWinThread from MFC, then you really don't need the
entire MFC library. Just use what's appropriate for a given module:
Module uses Use this to create a thread
------------ -------------------------------
MFC: CWinThread
CRT (no mMFC): _beginthread()/_beginthreadex()
No CRT or MFC: CreateThread() Windows API
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
An MFC DLL is a Win32 DLL. Getting it to compile has nothing to do with
the type of DLL.
The MFC header file(s) and/or Windows SDK header files need to be included
in a certain order.
Again, if you need to know for sure how to order the includes correctly,
create a temporary MFC project with the wizard and copy the way
stdafx.h is layed out. It's better than trying to guess.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi ,
I have a requirement , where I want one entity to be persistent in the computer.
I am struggling to decide on what this entity will be .
My model is such that I want to be able to intercept USB device notifications utilizing the WM_DEVICE_CHANGE messages by creating a hidden window in this entity and then update the elements of a system tray icon ( which exposes a Menu ) .
So my requirement does not fit the Client Server model , yet I am leaning towards COM to provide one EXE that does it all . So in other words , this entity will not provide any APIs for other clients to use . Am I unnecessarily using COM ?
So finally I need to finalize the form that this need to take .
Service - actually the Visual Studio 6 gives the option to create a COM Object as a Service.
COM DLL
COM EXE
Standalone EXE ?
Your inputs are really appreciated
Engineering is the effort !
|
|
|
|
|
I think a stand alone exe will do the trick. You can prevent more than one instance running at a time easily enough with a named mutex. You can have the main window as your hidden window which keeps things simple, perhaps one DLL to encapsulate the system tray icon stuff, I've seen that done well although it's not easy unless you're targetting only XP or only Server 200?, and another to encapsulate the USB WM_DEVICE_CHANGE stuff, I've written one like that but it's closed source . I can tell you that you may need to download a DDK to get the correct headers for the defines you might need, again if you use any XP and upward only defines it won't work on earlier system. Win2K in the earliest that has usably reliable USB device stuff although some things work a bit on Win98.
Do you need COM? You might need a little to get the System tray stuff to work, It's been too long since I looked at it, but nothing more complex than emulating a VB enumeration type if that.
A Service? No as long as you can start your app on or near startup and automatically I can't see the need for it being a service. A service shouldn't interact with the UI anyway so not if it's going to have an icon. Remember to scan for already plugged in USB devices on startup and also that they can be reported as fixed or removable, sometimes depending on the chipset revision on the removable media in the removable drive!
Enjoy
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|