|
There is a 3rd lib only accept char* filename e.g.
3rdlib_func_name(char* file_name) . Every things get wrong when I provide a filename in Chinese or Japanese.
Is there any way to make this lib open UNICODE filename? The program is running on Windows.
Thanks for your reply.
A Chinese VC++ programmer
|
|
|
|
|
zengkun100 wrote: Is there any way to make this lib open UNICODE filename?
Only by changing its source code. You will have to go to the suppliers of the library to get it changed if you do not have the source.
It's time for a new signature.
|
|
|
|
|
Richard MacCutchan wrote: Only by changing its source code. You will have to go to the suppliers of the library to get it changed if you do not have the source.
I think so.
In theory, char* cant only be used to point to a UTF8 UNICODE string, however, you cannot give a UTF8 filename to fopen or some other file functions. But if I transfer this UNICODE filename to char* using CP_ACP, some of the characters cannot be changed.
A Chinese VC++ programmer
|
|
|
|
|
Exactly right, which is why all software suppliers should be providing full Unicode support. I think you need to talk to the supplier of the library and get them to change it. You may also note that _wfopen is the Unicode version of the file open function, so there is no problem with Unicode file names.
It's time for a new signature.
|
|
|
|
|
Thanks for your reply again We have called our partner this afternoon.
A Chinese VC++ programmer
|
|
|
|
|
If your app is UNICODE!
Their is a function to change UNICODE string to CHAR!
wcstombs[^]
But I guess that won't fix it either if your filenames are in UNICODE.
|
|
|
|
|
Fareed Rizkalla wrote: If your app is UNICODE!
Their is a function to change UNICODE string to CHAR!
wcstombs[^]
But I guess that won't fix it either if your filenames are in UNICODE.
Yes, even if I transferred the UNICODE filename to a char*(using CP_ACP or CP_UTF8), the 3rd lib don't accept this filename and returns a "file not found" error code.
A Chinese VC++ programmer
|
|
|
|
|
Has anyone SetHotKeys before for a IShellItem!
I did setup a HotKey through
RegisterHotKey (g_hWindow, 0, MOD_CONTROL | MOD_NOREPEAT, 0x4E);
It works fine, but I want to use the IShellItem to hookup to the same HotKey.
Seen some examples using HOTKEYF_CONTROL instead MOD_CONTROL, which is it!
Some people confuse the HIWORD instead of the LOWORD, if anybody knows any solid details please help!
Thanks in advance.
|
|
|
|
|
Using visual studio 2008 I created a small vc++ project and ran it using the exe created.
The problem is the exe runs fine on my PC.
But when I tried to run the exe on an another PC it gave the error "The application has failed to start because the application configuration is incorrect. Reinstalling the application may fix this problem."
Any idea as to what may be causing this error and how to resolve it?
|
|
|
|
|
You have to install the VC2008 redistributable package (search on the MSDN website) on the target PC. This will install the MFC and C run-time libraries which are required by your application.
Another solution is to statically link against those libraries.
|
|
|
|
|
Thanks Cedric for the inputs.
Anyway I solved the issue by changing the project configuration.
In the Project Properties >>> C/C++ Code Generation >>> Run Time Library I selected /MT which solved the problem. Earlier it was /MD which which was causing the error.
|
|
|
|
|
Yes, it means you statically link against the run-time libraries as I said in my previous reply.
|
|
|
|
|
yes thanks for the hints.
|
|
|
|
|
Hello people!
In a "home project" i tried to inject a DLL into explorer's process with the "CreateRemoteThread" and the "Hook" method. Both seems to work fine for other processes (tried with notepad.exe, tried with a simple test app of my own...) but if i try to use explorer's process...major FAIL. The "CreateRemoteThread" method causes an instant reboot of the system. If i try to use the other method i either get "access denied" when trying to install a hook using SetWindowsHookEx into explorer's GUI thread, or if i install a global hook it simply does not get called for explorer only for other processes. With both methods i have enabled the "debug" privilege on "my own" process' access token.
So my question is simply this: does the system no longer allow DLL injecting into explorer? I googled around and i have found many references of this being possible, i mean, to inject DLLs to explorer with both methods, however, i did not find anything conclusive about this no longer being allowed, and since the articles that say it is possible are mostly rather old, things might have changed since then (new Service Packs came out, new patches for XP, and so on...). I checked my code against examples i have found online but i see no major differences, and i supose if the code itself was bad then it would not work for other processes either. I tried this on XP Pro SP3 if it matters.
Thanks for any hints in advance.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
modified on Wednesday, April 28, 2010 10:55 AM
|
|
|
|
|
Hi,
Code-o-mat wrote: The "CreateRemoteThread" method causes an instant reboot of the system.
I assure you that this is not normal. It sounds to me that you have a rogue security product or perhaps malware causing the reboot. I would recommend debugging the cause. Upon reboot a dump file should have been written into the %SYSTEMROOT%\windows\minidump folder.
I would recommend following the instructions here to determine the cause of the reboot.
How to read the small memory dump files that Windows creates for debugging[^]
Code-o-mat wrote: So my question is simply this: does the system no longer allow DLL injecting into explorer?
Yes you should be able to inject a DLL into the explorer process. Without looking at your code I cannot determine why it is failing.
Best Wishes,
-David Delaune
|
|
|
|
|
Hey!
Thanks for your words. Seems to be that the cause of the reboot is something else than i originally thought. When i tried the "windows hook" method and got the "access denied" message i assumed that it must be some security issue. I also tired the "code-cave" method on notepad and windows detected it and "shut down notepad to protect my security", this also streanghtened my assumption that it is somekind of "protect the user" mechanism. But after your post i started experimenting some more with the "Remote thread" method and i actually got the DLL into explorer, i also determined that the reboot comes when i try to use certain methods in the DLL, i also experienced deadlocks. For example, in the DLL i create a new thread which then would call "GetDesktopWindow" to get the handle of the desktop window but the thread seems to deadlock in this method, it never returns from it.
At this point i am clueless why this happens, if you have any pointers, please share. Thanks.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Hi all!
I meet a problem when I derive a class from CEdit. I want to use a font specficed by myself in it. Now I use the font in the message function of WM_CTLCOLOR in parent window of CEdit. The new font can be shown in CEdit. But when I double click the left-button or drag the mouse to select more than one character, the position of caret is wrong. I don't know how to fix it. Plz help me! Thx!
whiteclouds
There is some white cloud floating on the blue sky. That's the landscape I like.
|
|
|
|
|
Have you already tried
to set a font at the WM_CREATE reaction ?
virtual void BeHappy() = 0;
|
|
|
|
|
In WM_CREATE of CEdit? What difference between this and the action I take?
There is some white cloud floating on the blue sky. That's the landscape I like.
|
|
|
|
|
I think,
the difference is the settings purpose:
- your choice: the drawing (I guess, not in the edit mode)
- my choice: system assignment (I guess, for drawing and editing as well)
When you will want to use the class for a dialog item,
you could place the setting in your OnInitDialog() function :
...
m_cYourEdit.SetFont(..);
...
virtual void BeHappy() = 0;
|
|
|
|
|
I had test your method. I add some codes into OnInitDialog() of parent window as below:
CColorEdit *pEdit = (CColorEdit*)GetDlgItem(IDC_ED_COLOR);
if(pEdit)
{
CDC *pDC = pEdit->GetDC();
if(pDC)
{
pDC->SelectObject(m_fnt);
}
}
Then m_fnt can't be shown. And when I select some characters, the caret isn't in correct position.
There is some white cloud floating on the blue sky. That's the landscape I like.
|
|
|
|
|
Try it :
CWnd* pcWnd = GetDlgItem(IDC_ED_COLOR);
if (pcWnd->GetSafeHwnd()) {
pcWnd->SetFont(&m_cFont);
}
virtual void BeHappy() = 0;
|
|
|
|
|
Thx for your reply!
The position of caret is right now. But the font isn't be used in general. Only when I select the characters, the font can work.
That means, when not select any character, the OnPaint() respond function in the derived class hadn't work. Because I draw the characters using specific font in it. Maybe I make a mistake, isn't it?
Pls help me more! Thx!
There is some white cloud floating on the blue sky. That's the landscape I like.
|
|
|
|
|
It works in my OnInitDialog()
(I have not performed any font manipulations for WM_CTLCOLOR ) :
static CFont cFont;
cFont.CreatePointFont(120, _T("Arial"));
CWnd* pcWnd = GetDlgItem(IDC_EDIT1);
if (pcWnd->GetSafeHwnd()) {
pcWnd->SetFont(&cFont);
}
virtual void BeHappy() = 0;
|
|
|
|
|
I had test the code you provided. That can work correct. And I know that the problem was generated by my own class derived from CEdit. Thank you, Eugen Podsypalnikov!
There is some white cloud floating on the blue sky. That's the landscape I like.
|
|
|
|