|
everyone, thank for your answer.
Actually,My code set the background color to white (color = RGB(255,255,255))
I managed to fixed the problem by changing the dialog's font in GUI editor from "Ms Dialog Shell" to "Microsoft San Serif".
This is very strange. I guess it somekind of very obscure bug.
|
|
|
|
|
Hi,
I'm trying to resolve a Manifest issue. Member 'enhzflep' suggested some time ago that mainifest XML Code does not have to be included in the exe, but that it can be added as a separate XML file (MyProg.exe.Manifest) as an afterthought, rather than compiling it into the code.
I Proposed the following for an exe called Softguard Utility Program.
As soon as the Windows Loader sees this Manifest, it balks with Win32 error 140001. If I rename the exe file, it runs.
I'm doing at least something right in that the Windows Loader responds. The question is, What's wrong with the XML Code that makes the loader
balk. Better, How do I debug this issue. The Loader fails before the Debugger Starts.
Contents of MyProg.Exe.manifest
<pre><code><?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="SgBackup"
type="win32"/>
<description>Softguard Utility Program</description>
<!-- Softguard Utility Program -->
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2>
<security>
<requestedPrivileges>
<requestedExecutionLevel
level="requireAdministrator"
uiAccess="false"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly></code></pre>
thanks
Bram van Kampen
|
|
|
|
|
Hi Bram. Sorry to hear this is still giving you trouble.
I also just tried that manifest file with an app of mine and received an error on loading.
Here's one that I use, as generated by the ANSI version of ResEdit. ResEdit home[^]
<?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="CompanyName.ProductName.YourApp"
type="win32"
/>
<description>Your application description here.</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
Another useful utility for manifests is: XP Style Hacker: http://www.snapfiles.com/get/xpstylehack.html[^]
|
|
|
|
|
Taking all this on board.
BTW Could there be restrictions on the loader to stop inappropriate behaviour e.g. hacking, if the manifest asks for elevated status on a further non specified program module ?
Bram van Kampen
|
|
|
|
|
Pleasure.
Not really too sure what the problem is with that XML file, though on looking at this one I have here, I notice that you only have 1 pair of assemblyIdentity tags - I'm leaning away from it being a privilege escalation problem, but more towards the manifest being improperly formed.
Just found a blog that discusses manifests a little. I've tried the first one fro the page and it works fine. I then changed the requestedExecutionLevel to level="requireAdministrator", it still seems fine. Though I can run it with a guest account on xp - I don't know if this is the expected behaviour or not.
Here's the blog I mentioned:
http://blogs.msdn.com/cjacks/archive/2006/09/08/745729.aspx[^]
Here's the 1st manifest from that page:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<assemblyIdentity type="win32" processorArchitecture="*" version="1.0.0.0" name="MyApplication.exe"/>
<description>My totally awesome application</description>
<dependency>
<dependentAssembly>
<assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" language="*" processorArchitecture="*" publicKeyToken="6595b64144ccf1df" />
</dependentAssembly>
</dependency>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges>
<requestedExecutionLevel level="asInvoker"/>
</requestedPrivileges>
</security>
</trustInfo>
</assembly>
Good luck.
|
|
|
|
|
Hi,
Thanks, Got it working in the end.
Now I've to find a VISTA Machine to find out if the module can Modify
keys Stored under HKLM. That was the entire purpose of the excersise.
Thanks again for the Help.
Bram van Kampen
|
|
|
|
|
I try to define some kookeyboard hook.
But for some reason i getting error in the compile time
the code that maybe wrong is :
SetWindowsHookEx(WH_KEYBOARD_LL, keyboardHookAction, NULL, 0);
|
|
|
|
|
What's the error from the compiler?
Regards,
--Perspx
Don't trust a computer you can't throw out a window
-- Steve Wozniak
|
|
|
|
|
The error message is
error C3867: 'keyboardHookAction': function call missing argument list;
use '&::keyboardHookAction' to create a pointer to member
and the function that receive the keyboard hook event is declared in this way
keyboardHookAction(int code, int wParam, KBDLLHOOKSTRUCT lParam)
|
|
|
|
|
OK , but my hook need to catch all the keyboard event - all of them.
I think the way to do it is to set NULL as the third argument - and this what i did.
Where is my mistake ?
|
|
|
|
|
If you have declared keyboardHookAction as a class member, you must reference it with the class name, and a pointer symbol (&), for example &MyClass::keyboardHookAction .
And if you want to capture all keyboard events you need to put the hook procedure function in a DLL anyway - see this article for more information.
Regards,
--Perspx
Don't trust a computer you can't throw out a window
-- Steve Wozniak
|
|
|
|
|
How have you declared keyboardHookAction? Did you daclare it as a member of a
given class? PLS explain a little more ...
Thank you masters!
|
|
|
|
|
Try this:
::SetWindowsHookEx(WH_KEYBOARD_LL, HookFunction, AfxGetInstanceHandle(), 0);<br />
<br />
return TRUE;<br />
}<br />
<br />
LRESULT CALLBACK HookFunction(int nCode, WPARAM wParam, LPARAM lParam)<br />
{<br />
KBDLLHOOKSTRUCT *kbdllhookstruct = (KBDLLHOOKSTRUCT*)lParam;<br />
<br />
if(!(kbdllhookstruct->flags & 128 ))<br />
{<br />
DWORD dwKey = kbdllhookstruct->vkCode;<br />
<br />
if((GetKeyState(VK_SHIFT) & 32768) && (dwKey != VK_LSHIFT) && (dwKey != VK_RSHIFT))<br />
WriteToFile("<Shift+>");<br />
<br />
if((GetKeyState(VK_CONTROL) & 32768) && (dwKey != VK_LCONTROL) && (dwKey != VK_RCONTROL))<br />
WriteToFile("<Ctrl+>");<br />
<br />
if((GetKeyState(VK_MENU) & 32768) && (dwKey != VK_LMENU) && (dwKey != VK_RMENU))<br />
WriteToFile("<Alt+>");<br />
<br />
if(dwKey >= 0x30 && dwKey <= 0x5A)
WriteToFile((char*)&kbdllhookstruct->vkCode);<br />
else<br />
{<br />
switch(dwKey)<br />
{<br />
case VK_BACK:<br />
WriteToFile("<BackSpace>"); break;<br />
<br />
}<br />
}<br />
}<br />
<br />
return 0;<br />
}
www.logicsims.ir
|
|
|
|
|
Thanx! But I think he doesn't need a fish, he's gonna learn how to catch it!
Thank you masters!
|
|
|
|
|
|
Dont worry it was a leak memory!
|
|
|
|
|
And who R U? his causin?
Thank you masters!
|
|
|
|
|
Hi Guys
I am working with Visual Stusios 2005.
I have a solution with 2 projects in it.
Can I call a static member function that is declared in one project from the other project?
OtherProjectClass::StaticMemberFunction(variables);
At the moment I get error LNK2019
Thanks
|
|
|
|
|
You can export the class from the project that implements the class:
class __declspec(dllexport) test
{
public:
static void StaticMemberFunction();
};
void test::StaticMemberFunction()
{
}
Then on the consumer side, import the class:
class __declspec(dllimport) test
{
public:
static void StaticMemberFunction();
};
...
test::StaticMemberFunction();
Note that it's nicer to use a macro that expands to __declspec(dllexport)
or __declspec(dllimport) depending on the definition of a build-type macro:
#if defined(BUILDINGDLL)
#define MYIMPORTEXPORT __declspec(dllexport)
#else
#define MYIMPORTEXPORT __declspec(dllimport)
#endif
Then both sides can share the same header file for the class, making
maintainability easier (if the class changes you don't have to remember
to change it in two places):
class MYIMPORTEXPORT test
{
public:
static void StaticMemberFunction();
};
*EDIT* I forgot to mention - you'll need to add the import library<br />
for the implementing module to the importing project's linker input settings.
Mark Salsbery
Microsoft MVP - Visual C++
modified on Saturday, September 20, 2008 4:33 PM
|
|
|
|
|
Thanks for the comprehensive answer Mark. Really appreciate it
|
|
|
|
|
|
My directory structure is
Dir1
|---------file.exe
|---------angle.txt
|---------test.txt
|---------Dir2
|________Dir3
My code works like it just find the .txt files under Dir1, never find files under Dir2, Dir3 etc. Please tell me what's wrong with my code.
void CWinSearchDlg::SearchInternal(LPCTSTR path, CStdioFile *file)
{
CFileFind finder;
TCHAR szWildcard[MAX_PATH] = {0};
_sntprintf(szWildcard, MAX_PATH, _T("%s"), path);
PathAppend(szWildcard, _T("*.txt"));
BOOL bWorking = finder.FindFile(szWildcard);
while (bWorking)
{
bWorking = finder.FindNextFile();
if (finder.IsDots())
continue;
if (finder.IsDirectory())
{
SearchInternal(finder.GetFilePath(), file);
}
}
finder.Close();
}
modified on Saturday, September 20, 2008 9:51 PM
|
|
|
|
|
OF course except CfileFind you can use of FindFirstFile/FindNextFile.
|
|
|
|
|
fantasy1215 wrote: Please tell me what's wrong with my code.
Your wildcard is "*.txt".
Your subdirectories don't have a .txt extension so they won't
show up in the search.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
There are .txt files in Subdirs too.
|
|
|
|