|
Yes, but it is not displayed
|
|
|
|
|
As Madhu mentioned, WM_CTLCOLOR is not only for controls, but also for the dialog.
When the wParam is CTLCOLOR_DLG , you can return a brush for dialog box color.
Please read the documentation. It says it all.
|
|
|
|
|
i created a project which based win32, and i'll plan to create a mfc-dll for calling in win32, could this idea be implemented?
can you give me some similar code or related articles, thank you very much!
|
|
|
|
|
I guess you can call an MFC DLL from a Win32 application.
You should actually try it.
|
|
|
|
|
nenfa wrote: can you give me some similar code or related articles
Here is a sample article for calling a dll function[^] in C++
|
|
|
|
|
thank you, but it can fit my request, i real demand is to use controls like CSlider which are implemented in MFC-Dll
|
|
|
|
|
i have defined the macro which names M_DEBUG(str, msg),
now i want to rename the M_DEBUG for special usage, and i do like this:
#define _M_DEBUG(str, msg) M_DEBUG(str, msg)
but it happens that "_M_DEBUG" : undeclared identifier, why?
|
|
|
|
|
sorry, it can do!
i just used error macro-name
|
|
|
|
|
Does anyone know the fix for Windows Explorer when dealing with setting (re-setting) permissions?
I've changed this folder numerous times from Read Only clicked the applied button selected the applied to sub-folders and files. But when I again check it it is again Read Only. How do you fix this? I checked the Security tab and "Full Control" is under all available selections. What is stopping my selections?
A C++ programming language novice, but striving to learn
|
|
|
|
|
It is probably also a system folder which is why you're not able to remove its read only property.
If it is a system folder, it is not a good idea to change its attributes.
However, if you still want to change it, here is something you can try.
Open a command prompt with elevated privileges and change to the folder.
Try the command attrib -r -s *.* /S /D
|
|
|
|
|
Hi, I would like to do the following:
Allocate datas in a dll and then free them in the main application.
I have read there are potentials problems doing this because dll and process don't share the same memory, it depends on the compiler,... don't do this - ok.
So I was looking for a solution and I went accross the Heap functions.
It seems that when I allocate memory like this:
HeapAlloc(GetProcessHeap(),... the default Heap is used to store the memory. Then the dll and my application will share the same Heap for that data.
So they share the same Heap, but I still wonder if it safe is to call HeapAlloc from the dll and HeapFree from the application for the same data ?
Any idea ?
Yarp
http://www.senosoft.com/
|
|
|
|
|
why can't you provide your own FreeMyDllObject() funtion inside the DLL, matching the way your DLL code allocates its stuff. Then the caller doesn't have to know the messy details, and there is less dependency between EXE and DLL. Later on, you could even change your DLL's memory management without changing the EXE at all.
|
|
|
|
|
Hi Luc,
There are various situations and memory is not always allocated in the same place.
I have got 3 different case:
- a DIB allocated in main thread and used in the dll
- a DIB loaded in a thread used in the dll
- a DIB loaded in a dll used in main thread
I would need 3 different FreeMyObject for a unique DIB class while this HeapAlloc / HeapFree possible solution is common, and as simple as new / delete.
I see it as a great simplification. Provided it is reliable on all systems.
Thanks for your answer.
Yarp
http://www.senosoft.com/
|
|
|
|
|
I have implemented a small web server inside a dialog application that host the web browser control.
On a good scenario, this is what happens: I pass the url to the webbrowser control and it downloads all files from my server and displays it correctly. Something like:
CString navigateTo;
navigateTo.Format((TEXT("http://127.0.0.1:%d/%s")), m_nListeningSocketPort, GetFileName() );
try {
m_IExplorer.Navigate( navigateTo, 0, 0, 0, 0 );
}
...
explorer then gets all the files needed from the web server and all is ok. Then I disconnect from internet and from that point on internet explorer doesn't download anything. It doesnt even try to contact the server!
Events go like this:
http:
BeforeNavigate2Webbrowser()
DownloadBeginWebbrowser()
DownloadBeginWebbrowser()
DownloadBeginWebbrowser()
DownloadBeginWebbrowser()
NavigateErrorWebbrowser():: URL: http:
BeforeNavigate2Webbrowser():: URL: res:
DownloadBeginWebbrowser()
DownloadBeginWebbrowser()
NavigateComplete2Webbrowser():: URL: http:
NavigateError() reports INET_E_DOWNLOAD_FAILURE. Can anyone explain what's going on? How can I force the web browser to contact to local web server? I implemented additinal test to verify server is up and running, and it's all good.
|
|
|
|
|
Is your browser getting switched to "Work offline" mode?
-Suhredayan
|
|
|
|
|
Two questions.
if you're dialup to connect internet?
Check local webserver (like IIS or any other local webserver) is configured. also as said in the previous answer, check if it's enabled to work offline to get the offline content.
else if
you're using proxy, in the internet settings->LAN settings, exclude proxy from local address.
-Sarath.
Rate the answers and close your posts if it's answered
|
|
|
|
|
Thnx for the answers, the server works fine. The problem was in the way ie control works when you put it to offline with .put_Offline(TRUE). Then it never tries to go online.
But when you set the control to online and check the "Work Offline" option in IE, then the control asks to go online. Just didn't occur to me it works that way... Needed just a good night's sleep
|
|
|
|
|
I have seen some applications warn that you have to run it in admin mode, if you do not run it in admin mode in both Windows Vista and 7. How do they detect if it is running with admin privileges or not.
Some application even invoke the UAC (user access control) dialog to pop up, as soon as they run.
Please someone enlighten me about this.
|
|
|
|
|
It's not the application that detects if you're running as admin or not, it's the OS. Any user of Vista/Windows 7 (including Administrator) by default do not run with admin privilege - it must be requested.
Certain actions require admin rights - like writing to HKEY_LOCAL_MACHINE in the registry or creating files within the Program Files directory (and sub-directories).,
You can make your app show that UAC dialog and request admin rights by using the following manifest file.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity version="1.0.0.0" processorArchitecture="X86" name="YourApp" type="win32"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="requireAdministrator"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
Save this file in the folder containing your app with the same name as your app and the extension of .manifest.
For instance, if your app is called MyTestApp.exe, save this file as MyTestApp.exe.manifest. Now when you run the app it will pop up the UAC dialog.
Hope that helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
|
|
No. Adding manifest is not the solution. I think its the process properties that one should look into.
|
|
|
|
|
When I use the following method to disable menu items, only popup ones can be disabled, the top-level menus and other sub-menus seems to do nothing!
<br />
CMenu* menu = CMenu::FromHandle(m_wndMenuBar.GetDefaultMenu());<br />
menu->GetSubMenu(1)->EnableMenuItem(1, MF_BYPOSITION | MF_DISABLED | MF_GRAYED);<br />
This method is OK with CMenu in VS 2005.
Thanks for the helps!
|
|
|
|
|
Perhaps this may give you a clue - I've used this many times to disable a top-level menu:
if (pCmdUI->m_pSubMenu != NULL)
{
pCmdUI->m_pMenu->EnableMenuItem(pCmdUI->m_nIndex, MF_BYPOSITION |
(bShowMenuItems ? MF_ENABLED : (MF_DISABLED | MF_GRAYED)));
}
This code is in the UpdateCmdUI handler for the menu, so it takes care of getting the CMenu that I'm concerned with - you'll need to modify it for your needs.
Hope this helps.
Karl - WK5M
PP-ASEL-IA (N43CS)
PGP Key: 0xDB02E193
PGP Key Fingerprint: 8F06 5A2E 2735 892B 821C 871A 0411 94EA DB02 E193
|
|
|
|
|
Thank you so much, but I still failed in disable top-level menus just like File, Edit, etc.
I tried by add UPDATE_COMMAND_UI to a menu item, pCmdUI->SetRadio & pCmdUI->SetCheck turn out to be success, but pCmdUI->EnableMenuItem or pCmdUI->Enable still work in vain.
pCmdUI->EnableMenuItem do work well with menu items that have submenu.
So I will be appreciated if you can tell me something more about your trick, especially that how can I disable all top-level menu items by using one cCmdUI.
Thanks a lot!
|
|
|
|