My guess is that he compiled/linked his application fine but it didn't work on other computers... applications developed using VC2008 would most likely require .NET framework to run, make sure your clients have .NET framework installed on their own machines.
Abin
Posts
-
VC 2008 problem -
OpenProcess FailsCould you please explain a bit more?
-
OpenProcess FailsWhat would you do if
::OpenProcess(PROCESS_VM_READ, FALSE, dwProcessID)
fails with error code 5 (Access is denied)? WheredwProcessID
is a valid process ID. Is there any way to work around this problem? -
CHotKeyCtrl and "space"While being handy and nice, the MFC CHotKeyCtrl class does act weird sometimes, for example, it does not recognize the "space" key, instead, it rejects the keystroke and cleans all existing contents just like I pressed the "backspace" key. Now the funny thing is that, if I set the "space" key programmatically
m_wndHotkey1.SetHotkey(VK_SPACE, 0);
it will work, just that it cannot be specified by user input. Unfortunately I really want the "space" key to be one of the configurable hotkeys in my application. Do I have a way to work around this problem? Thank you. -
Hight Quality Bitmap Stretching Displaying?Sometimes I need to display a bitmap much smaller then its original size, by using the
StretchBlt
API I get sadly ugly outcomes, I've noticed many picture-viewer applications have the ability of stretch-displaying pictures while maintaining high quality, some of them(IE 6.0, etc) can even do that job absolutely perfect. I wonder if I too can implement that in my own projects? Any help are appreciated. -
Save into a UTF-8 file?I'm currently working on a project which needs to read contents from an ANSI text file and save into another text file in UTF-8 format, in fact it needs to convert about a thousand files from ANSI to UTF-8 and those old ANSI files must remain unmodified. Any suggestions? I'm not familiar with text encoding stuff...
-
Is there any way to verify a HHOOK?Well, for some odd reasons the
GetMsgProc
function in my application was never called, even thoughSetWindowsHookEx(WH_GETMESSAGE,GetMsgProc,m_hInstance,0)
had succeeded... Weird isn't it? It was an MFC dialog based application. -
Is there any way to verify a HHOOK?You are a lifesaver!
-
Is there any way to verify a HHOOK?In a recent project I used WH_JOURNALRECORD to moniter certain events occur in a particular application window, but as MSDN said, as soon as the user press "CTRL+ESC" or "CTRL+ALT+DEL", all installed WH_JOURNALRECORD hooks will be wiped out by the OS... When this happens, my application does not know, so it would still wait for messages(which will never come anymore) from the target window. My questions is that, is there any way to verify whether a HHOOK handle is still on a "valid" state, so I can reinstall the hook if needed? Thanks
-
Keyboard Input - MFCYou need to do it in PreTranslateMessage.
BOOL CMyDialog::PreTranslateMessage(MSG* pMsg) { // TODO: Add your specialized code here and/or call the base class if (pMsg->message == WM_KEYDOWN) { if (pMsg->wParam == some_key_code) { Do_SomeThing(); } } return CDialog::PreTranslateMessage(pMsg); }
-
Picking transparent color from a gifHow do you programmatically set transparent color in a gif file? For example I have a gif file "c:\\a.gif", I wish to: Open c:\\a.gif. Set the black color, RGB(0,0,0), as the transparent color. Save the file back to c:\\a.gif. After that when I open c:\\a.gif using photoshop or whatever, the gif displays black as transparent color. Can we do that? Thank you.
-
Retrieving Mouse State?Is there any API that allows me to retrieve mouse state? Not cursor position, but the presses/unpressed state of mouse buttons. Thanks.
-
Stop removal of null charactersAs far as I can think, the closest solution should be replacing those null's with some other characters those otherwise will never be used in your application, for example, if your sure you'll never use the character '#', then:
// how long is your header gonna be, then how many #'s here
#define THE_HEADER _T("###...##")// To make your packet:
CString sPacket = CString(THE_HEADER) + _T("your real contents");// Now send your packet
socket.Send((LPCVOID)(LPCTSTR)sPacket, sPacket.GetLength() * sizeof(TCHAR));// And the receiver then replace the #'s with null's
TCHAR szReceived[1024] = _T("");
receiver.Receive((LPVOID)szReceived, 1023); // suppose 1023 is enough
for (int i = 0; szReceived[i]; i++)
{
if (szReceived[i] == _T('#'))
szReceived[i] = _T('\0');
}// Now you get what you want
-
MFC and its BOOL type...Yeah I was told about that before. Only thing I wonder, though, is that why they used an
int
not anBYTE
, to represent such a type that merely needs to maintain "yes or no", but then I guess we've all used to that already. -
GetModuleHandle ProblemHi, every one, I got a problem when using the
::GetModuleHandle
API, it always fails if I pass in an absolute path, for example,::GetModuleHandle("c:\\my app\\app.dll");
will fail even though the file "c:\\my app\\app.dll" exists, but if I copy the program into that directory and call::GetModuleHandle("app");
it succeeds. Why can't I use an absolute path for the module? Thank you. -
Solution Needed PleaseI'm currently on a project which needs to exam memory contents of an other process, basically, it searchs for certain pattern in the target process's page memorys, if pattern found then do some further examination, else keeps searching for same pattern. I did it by this way: First, I use
::VirtualQueryEx
to obtain all pages of the target process and store those page information(base address and page size) in an array. This step completes in no time. Second, I use::ReadProcessMemory
to read the memory from each page(bytes by bytes) and compare the bytes with my predefined pattern, which are an array of bytes, usingmemcmp
. I will finally find the memory address that I want for sure, but the problem is that it's slow, very slow. The target process has over 500 pages and total size of which are over 70MB, it takes like 50 seconds to finish the searching, and that makes my application completely useless. Now since you guys are all gurus out here, I think there must be something to do to shorten the search time, please help and thanks in advance. -
Get Window HANDLEs of a ProcessHaving the process ID or HANDLE of a particular process, is there a way to find out its main window(or enum through all windows those were created by that process)? Thank you.
-
GDI Gurus, EllipsesI just wonder how
::Ellipse
and::ArcTo
were implemented(orCDC::Ellipse
,CDC::ArcTo
in MFC library), I really wish I could have a chance to see the source code of those functions, or less than that, an idea how it was possible to draw an ellipse(not a circle) on the screen, by being given a mere boundary rectangle. I guess there got to be a lot of plane geometry involved, hell, wouldn't it be terribly time consuming to calculate coordinates of every single point on the arc? -
Is It Possible to do this?1. there is a title bar;
BOOL bHasTitleBar = this->GetStyle() & WS_CAPTION;
2. there is no caption on the title bar;
CString sCaption;
this->GetWIndowText(sCaption);
BOOL bHasCaptionOnTheTitleBar = sCaption.GetLength() > 0;3. there is a caption on the windows task bar button.
// Huh? If a window has caption on its title bar, then
// it also has the same caption on the system task bar button,
// if it does have a task bar button.
// If you mean "this window has a task bar button"
BOOL bHasTaskBarButton = (this->IsWindowVisible() && this == AfxGetMainWnd()); -
Show DesktopHow do you programmatically show desktop, just like that ".scf" file(%APP_DATA%\\Microsoft\\Internet Explorer\\Show Desktop.scf) does?