|
Are you using MFC?
Because 23 out of 24 calls to find a resource only use FindResource instead of FindResourceEx .
The FindResource function determines the location of a resource with the specified type and name in the specified module. To specify a language, use the FindResourceEx function.
I am 'guessing' that the FindResource function returns the first resource it finds matching the module, name, and type, regardles if it matches the user's current language settings or not. For exmaple, look into the MFC source code at AfxFindResourceHandle .
Your best bet might be to write a wrapper for FindResource, and get it linked ahead of ALL the other libraries your app uses, or else hijack it. It can obtain the user's current language (see AfxGetPropSheetFont in MFC source as a decent example) and then you might have better luck.
Review these article (by title) on CP for some ideas:
APIHijack - A Library for easy DLL function hooking.
DLL Injection and function interception tutorial
HookImportFunctionByName v1.0
|
|
|
|
|
Hello,
I have an activeX control. I'm using class wizard to create the interface. How do I specify a parameter as an OUT parameter?
Thanks!
-Ian
|
|
|
|
|
Nevermind, I figured it out!
|
|
|
|
|
ok,im trying to work with António Feijão,Remote Library
ContextRemoteExecute, to execute code into an remote process(on windows 2000 SP4).I would post the code but its rather long winded,but basically here is what im doing
1-open remote process
2-allocate memory with VirtualAllocateEx
3-write my code to allocated spot
4-suspend thread
5-get threads context registers
6-change the threads Eip to my allocated mem (0x00C7001C)
7-resume thread,and it crashes.
here is the disassembly of the remote process(location returned by VirtualAllocateEx and where my injected code lies)
00C6FFFF ?? ???
00C70000 55 push ebp
00C70001 8B EC mov ebp,esp
00C70003 83 EC 40 sub esp,40h
00C70006 53 push ebx
00C70007 56 push esi
00C70008 57 push edi
00C70009 B8 B8 0B 00 00 mov eax,0BB8h
00C7000E 50 push eax
00C7000F FF 15 A0 88 4F 00 call dword ptr ds:[4F88A0h]
00C70015 5F pop edi
00C70016 5E pop esi
00C70017 5B pop ebx
00C70018 8B E5 mov esp,ebp
00C7001A 5D pop ebp
00C7001B C3 ret
00C7001C E8 00 00 C7 00 call 018E0021 //here is the problem
00C70021 EB FE jmp 00C70021
00C70023 00 00 add byte ptr [eax],al
00C70025 00 00 add byte ptr [eax],al
now i dont understand why "E8 00 00 C7 00" is calling 018E0021 ?? shouldnt it "call 00C70000" like its suppose to?
|
|
|
|
|
I read on the web that you can add a COleDateTimeSpan to
a COleDateTime. How can I do this?
I want to put together a function that adds days to a current
date. Im really having a hard time with this. The algorithm
works for awhile, and then I start getting -1/-1/-1 for the
dates.
Please, any response any one can give me will be greatly
appreciated.
Sincerely,
Danielle Brina (an overworked graduate student)
|
|
|
|
|
Something like:
COleDateTime today = COleDateTime::GetCurrentTime();
COleDateTimeSpan oneDay(1, 0, 0, 0);
COleDateTime tomorrow = today + oneDay;
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Is there any easy way to add a month, a half-year or a year to
the current date using COleDateTimeSpan?
|
|
|
|
|
DanYELL wrote:
Is there any easy way to add a month...to
the current date using COleDateTimeSpan?
Sure there is. Given that you know what month it is, just add the number of days in the current month and you'll get the same date in the next month. For example, today is June 14th. June has 30 days. Add 30 days to June 14th and we get July 14th. Make sense?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi guys,
I have a string, for example '1085462900'. I have to convert this string into a CTime / COleDateTime value. How can i do this?
I get this string from a oracle database.
P.
|
|
|
|
|
What does that number represent?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
This number represents Date and Time. The field on the database is from type int which contains this number.
|
|
|
|
|
P-Rex wrote:
This number represents Date and Time.
I figured that much out. Is it the number of seconds since a particular date? Is it the BCD form of a date? Be specific.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Just for the common knowlege. This number is called UTC time and represents the number of seconds ellapsed since 1.1.1970, it is 0+ GMT time zone without day light saving addition
DavidR
|
|
|
|
|
DavidR_r wrote:
This number is called UTC time and represents the number of seconds ellapsed since 1.1.1970...
Ok, both CTime and ColeDateTime have constructors for handling such a value.
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
try
CTime ct = CTime((time_t)(_atoi((const char*)cs)));
and see if it matches the Oracle value
|
|
|
|
|
Thank you guys
it works fine
|
|
|
|
|
hiho@ll
i have some trouble with a browser helper object
using Internet Explorer is no problem, but if i close IE i get an Error message (somethings reading from space which it isn't allowed)
i traced a bit using MessageBox and i found that the helper object destroys itself correctly using the WindowProc WM_Destroy event
then i get the error
and then DllCanUnloadNow is called successfully!
so what function is normally between the destroy windowproc and dllcanunloadnow?
thx@ll
|
|
|
|
|
Hi all
Wonder if you can help me, we are currently programing in MFC for our app which is dialog based - floating windows with 2 dialogs.
Our plans require more dialogs and a way to manage them on screen. What are are looking to do is create a "docking" architeture simlar to the toobars used in Photoshop (but at teh application top level).
Does anyone know of a component or toolkit that allows / helps build a dialog based UI with docking (allowing multiple dialogs to doc) / rollups etc ... or have any pointers or construction ideas?
All help very gratefully recived...
|
|
|
|
|
i used CWinThread.. the error message i'm getting is TrayDialog.obj : error LNK2001: unresolved external symbol "public: __thiscall CTrayDialog::CTrayDialog(void)" (??0CTrayDialog@@QAE@XZ).Please help..
CWinThread *pThread;
UINT Thread(LPVOID lp)
{
while(1)
{
AfxMessageBox("In Thread!");
Sleep(300);
}
return 0;
}
void CTrayDialog::TestThread()
{
CTrayDialog *obj;
obj=new CTrayDialog;
pThread=AfxBeginThread(Thread,obj);
}
thanks,
vivek
|
|
|
|
|
Hello,
Add the following lines of code to TrayDialog.cpp:
CTrayDialog::CTrayDialog() : CDialog(NULL, CTrayDialog::IDD)
{
}
What you are doing here is add the unresolved external symbol (the default contructor), but I think that you need an other solution: change the following code:
void CTrayDialog::TestThread()
{
CTrayDialog *obj;
obj=new CTrayDialog;
pThread=AfxBeginThread(Thread,obj);
}
to:
void CTrayDialog::TestThread()
{
CTrayDialog *obj;
obj=new CTrayDialog(this);
pThread=AfxBeginThread(Thread,obj);
}
Hope this helps.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
thanks for ur help... but,
:(Compiling...
TrayDialog.cpp
D:\CLTRK\CLTRK02\TrayDialog.cpp(40) : error C2039: 'IDD' : is not a member of 'CTrayDialog'
d:\cltrk\cltrk02\traydialog.h(39) : see declaration of 'CTrayDialog'
D:\CLTRK\CLTRK02\TrayDialog.cpp(40) : error C2065: 'IDD' : undeclared identifier
D:\CLTRK\CLTRK02\TrayDialog.cpp(487) : error C2664: '__thiscall CTrayDialog::CTrayDialog(unsigned int,class CWnd *)' : cannot convert parameter 1 from 'class CTrayDialog *const ' to 'unsigned int'
This conversion requires a reinterpret_cast, a C-style cast or function-style cast
Error executing cl.exe.
MyTrayDlg.obj - 2 error(s), 0 warning(s)
what to do now bob? what's that IDD?
vivek
|
|
|
|
|
Normally, when you use MFC and you create a dialog class, this class has a member called IDD. This is the dialog resource (how the windows looks and what controls are on it).
Since I don't know your classes, I don't know why you don't have them, but you can remove the line: : CDialog(...) .
viveking wrote:
D:\CLTRK\CLTRK02\TrayDialog.cpp(487) : error C2664: '__thiscall CTrayDialog::CTrayDialog(unsigned int,class CWnd *)' : cannot convert parameter 1 from 'class CTrayDialog *const ' to 'unsigned int'
I must have switched the parameters. So the dialog resource comes second instead of first. If you are wondering what the other parameter is, it's the parent window of the dialog.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
forget everything.... i'll come with a simpler example.. please wait.
vivek
|
|
|
|
|
Though it looks primitive.. please dont ignore..
see the class test with its data member "text" and function "disp()"
i wanna access it from the Thread1 and Thread2..
#include <afxwin.h>
#include<afxext.h>
#include<stdio.h>
char fValue[10];
CWinThread *pThread1,*pThread2;
UINT Thread1(LPVOID lp)
{
CClientDC cdc(AfxGetApp()->m_pMainWnd);
int j=250;
for(int i=1;i<=600;i++)
{
cdc.TextOut(i,j,"Thread1");
cdc.SetBkColor(0x0009999);
Sleep(6);
strcpy(fValue,"Thread1");
Text = fValue; ///// I WANT TO ACCESS THE DATA MEMBER "TEXT" FROM CLASS TEST//
cdc.TextOut(500,500,Text);
}
disp();/// HOW TO ACCESS MEMBER FUNCTION "DISP" FROM CLASS TEST//
return 0;
}
UINT Thread2(LPVOID lp)
{
CClientDC cdc(AfxGetApp()->m_pMainWnd);
cdc.SetBkColor(0x0990009);
int j=280;
for(int i=1;i<=600;i++)
{
cdc.TextOut(i,j,"Thread1");
Sleep(5);
strcpy(fValue,"Thread2");
Text = fValue;///// I WANT TO ACCESS THE DATA MEMBER "TEXT" FROM CLASS "TEST"//
cdc.TextOut(500,500,Text);
}
disp();/// HOW TO ACCESS MEMBER FUNCTION "DISP" FROM CLASS TEST//
return 0;
}
class test
{
public:
CString Text;
void disp()
{
AfxMessageBox(Text);
}
};
CMenu cm;
class MyWindow: public CFrameWnd , public test
{
public:
MyWindow()
{
Create(0,"Threads of MFC");
}
void q()
{
PostQuitMessage(0);
}
void Threads()
{
AfxMessageBox("Starting....");
}
DECLARE_MESSAGE_MAP()
};
BEGIN_MESSAGE_MAP(MyWindow,CFrameWnd)
END_MESSAGE_MAP()
class MyWin:public CWinApp
{
public :
BOOL InitInstance()
{
MyWindow *x;
x=new MyWindow;
m_pMainWnd=x;
pThread1=AfxBeginThread(Thread1,x);
pThread2=AfxBeginThread(Thread2,x);
x->ShowWindow(SW_SHOWMAXIMIZED);
return 1;
}
};
MyWin App;
thanks bob,
vivek
|
|
|
|
|
viveking wrote:
disp();/// HOW TO ACCESS MEMBER FUNCTION "DISP" FROM CLASS TEST//
Try:
UINT Thread2(LPVOID lp)
{
MyWindow *mw = (MyWindow *) lp;
mw->disp();
return 0;
}
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|