|
I have a large client area, and scroll bars are needed to view it all. Using the normal code puts only the visible area in the clipboars. I need to dump the visible as well as the non-visible part of the client area on to the clipboard. Please help!!!
|
|
|
|
|
I made an app that can run on Win9x/Win2k.
I want that on Win2k my dialog become transparent, so I used the fonction SetLayeredWindowAttributes(...). It won't compile, I've added /D "_WIN32_WINNT=0x0500" to the compiler additional Options, now it compils but don't work on Win9x...
Is it a way to make my app work on all Windows ?
|
|
|
|
|
Unfortunately not... Transpareny was introduced in W2K (WinNT 5.0)
|
|
|
|
|
Yes I know, but I thought that the app can run on Win9x and the fonction simply ignored....
And I know I can load SetLayeredWindowAttributes directly from "User32.dll" with LoadLibrary blabla, but I was asking if there is a solution to simply use SetLayeredWindowAttributes (I don't need to load it from User32.dll because I have the last Platform SDK) and make my app run on all Windows (and the fonction does nothing on Win9x).
Ouch sorry for my english I hope someone will understand what I want to say ;o)
Anyway, Lakitu thanks for your answer.
|
|
|
|
|
OSVERSIONINFO os;
::GetVersionEx(&os);
if ( os.dwMajorVersion>=5 )
SetLayeredWindowAttributes(...).
MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site.
|
|
|
|
|
Yes I know this code, but it doesn't solve my problem !
To compile it I have to set /D "_WIN32_WINNT=0x0500" but when I set that it doesn't work on Win9x :-/
|
|
|
|
|
Put this code in a separate DLL. And make two versions of this DLL, one without _WIN32_WINNT=0x0500. From your main app, you then just need to load the appropriate DLL depending on the os version.
This DLL remains small, which is may be a better approach than having two whole apps compiled for each target os.
MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site.
|
|
|
|
|
The alternative is to write a wrapper function for the one you're trying to use, which detects the OS version and if it's Win2000/XP or later, gets the address of the function from USER32 and calls it, otherwise does nothing.
Your problem is two things;
You don't have the function declaration unless you have _WIN32_WINNT set to 0x0500, and with that in place, you have a reference to the function in your EXE.
When the EXE runs on an earlier (NT,9x) system, the function cannot be located by the import lib code you pulled in when you built.
You can either do what Stephane suggests, what I suggest, or not use the function
Steve S
[This signature space available for rent]
|
|
|
|
|
|
hi all,
can u please tell the function to get the application path in MFC
|
|
|
|
|
char strAppPath[256];
GetModuleFileName(NULL, strAppPath, sizeof(strAppPath));
|
|
|
|
|
I use follow function:
CString GetHomeDirectory() const
{
TCHAR sFilename[_MAX_PATH];
TCHAR sDrive[_MAX_DRIVE];
TCHAR sDir[_MAX_DIR];
TCHAR sFname[_MAX_FNAME];
TCHAR sExt[_MAX_EXT];
GetModuleFileName(AfxGetInstanceHandle(), sFilename, _MAX_PATH);
_tsplitpath(sFilename, sDrive, sDir, sFname, sExt);
CString rVal(CString(sDrive) + CString(sDir));
int nLen = rVal.GetLength();
if (rVal.GetAt(nLen-1) != _T('\\'))
rVal += _T("\\");
return rVal;
}
Best regards,
Eugene Pustovoyt
|
|
|
|
|
I used these set of codes
<br />
CString StrLaunched;<br />
TCHAR szFullPath[MAX_PATH];<br />
TCHAR szDir[_MAX_DIR];<br />
TCHAR szDrive[_MAX_DRIVE];<br />
::GetModuleFileName(NULL,szFullPath,MAX_PATH);<br />
_splitpath(szFullPath, szDrive, szDir, NULL, NULL);<br />
<br />
<br />
cheers,
Super
------------------------------------------
Too much of good is bad,mix some evil in it
|
|
|
|
|
Can I load a combo box from a id (resource id) to get a CComboBox class, like the CMenu function 'LoadMenu' ???
I want write some code like this, but with a combo box:
CMenu menu;
menu.LoadMenu(ID_MYMENU);
...
--> I want write something:
CComboBox box;
box.xxx(ID_MYBOX);
...
(Does it give any function for 'xxx' ???)
Does it give any function for CComboBox to do this ???
--
Nice greets, Daniel.
|
|
|
|
|
You can enter the combo-box selections in the resource-editor, in the properties of the combo-box control, rider 'Data'.
This is stupid IMHO, as you have one more place to work at if you need to change the combo-box.
Better load strings from the stringtable and add these to your combo-box.
So you see in your code what is added to your combobox and you keep your code free from string constatants.
|
|
|
|
|
I can't edit the properties of the combo box in the resource editor, because the combo box is not created on a dialog. The combo box is placed in a command bar and is created with the 'CommandBar_InsertComboBox' function. So, the only thing I have is the ID of the combo box. I can edit the combo box with the 'GetDlgItem' and the 'SendMessage' function, but I use the mfc and so I want use the CComboBox class. So I need a function like 'LoadMenu' for the CMenu class for the CComboBox.
(I program on a pocket pc with eVC++ 3.0)
--
Nice greets, Daniel.
|
|
|
|
|
Try :
CComboBox* combo = (CComboBox*) GetDlgItem(YOUR_COMBO_ID);
|
|
|
|
|
Thanks!!!
--
Nice greets, Daniel.
|
|
|
|
|
Daniel S. wrote:
pocket pc with eVC++ 3.0
I have no idea about this platform. So all I can say is for the 'real' MFC.
But if you have a CComboBox , you can use AddString() , or CB_ADDSTRING as a message to the control.
For loading all entries at once like a menu, you could load the menu, get the texts, and call AddString() with it in a derived class.
|
|
|
|
|
I've created an MFC-dll.
Now I want to execute the app inside the dll. Which program do I have to use for that? Rundll.exe, Rundll32.exe (what's the difference)?
Or are there any other programs?
This is what I did (and it didn't work ):
Inside vc6 I pressed ctrl-f5 to run the app, a popup appeared requesting a dll-executer. I browsed to windows/rundll32.exe and selected it. But the dll was never executed.
What am I doing wrong?
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
|
|
|
|
|
, you can't run dll's?
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
yes you can
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
|
|
|
|
|
Do you want to run a specific function exported from your dll?
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|
|
syntax : rundll32 DllName,FunctionName [Arguments]
Where FunctionName is an entry-point (any function) with the following prototype :
void CALLBACK EntryPoint(
HWND hwnd,
HINSTANCE hinst,
LPTSTR lpCmdLine,
int nCmdShow
);
Interesting stuff is that WinMain() has this prototype too, but this was easily predicted.
MSDN doc[^]
rundll.exe is the former 16-bit counter part (now legacy).
If the DLL is an in-proc COM component, you may instead use the DllHost.exe surrogate process, though it works differently.
MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site.
|
|
|
|
|
I'm calling rundll from VC6.
So the settings are:
Executable for debug session:
c:\windows\rundll32.exe
Working directory:
empty
Program arguments:
empty
Remote executable and path name:
empty
Where do I have to put the functionname?
Is it fn() or just fn without ()?
I don't have to state the dll-name, isn't it?
btw:
I've tried several combinations, but none of them work.
I can switch to release version if debug doesn't work.
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
|
|
|
|