|
kristna wrote:
But I couldn't use unshift alphabet in SendMessage...
What does the call to SendMessage() look like?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
It is not working for characters beyond 96. Any other way ?
void CWordPadView::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
// TODO: Add your message handler code here and/or call default
switch(nChar)
{
case 'b':
SendMessage(WM_CHAR,'e',0);
break;
...
Can I get some solution ?
Jai Srimannarayana
Jai Srimannarayana
|
|
|
|
|
Is it possible (legally?) to hook CoCreateInstance / CoGetClassObject class for the current process?
I'm trying to move global component registration to side-by-side-DLL's, and hooking these would make the process awfully efficient
Pandoras Gift #44: Hope. The one that keeps you on suffering. aber.. "Wie gesagt, der Scheiss is' Therapie" boost your code || Fold With Us! || sighist | doxygen
|
|
|
|
|
You can redirect CoGetClassObject() on a per-CLSID basis by setting the TreatAs reg entry in the HKCR\CLSID\{guid} reg key; there are docs on this under "TreatAs" and "CoTreatAsClass" in MSDN.
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
I've hooked CoGetClassObject with success, but I also had to hook LoadTypeLibEx as well. The reason is because even tho it was LoadLibrary'd from the correct location, a previously registered activex control may trigger LoadTypeLibEx (not sure what does trigger it) to load the dll as a resource and use the IDL contained within. Caused me much grief for a bit as I knew the dll was loaded correctly, but the activex calls were calling the wrong stuff.
There are other "TypeLib" functions you may need to hook as well. I had a specific need and didn't research all the variations.
Hope this helps.
--
Joel Lucsy
|
|
|
|
|
Hi,
Has any one tried to compare two images using the cximage library. If you know how to do it or if you have any sample codes. Please help me with that. Thanks a lot.
Madhurya.
|
|
|
|
|
My method was to convert the images to grey scale and then check each pixel.
But I was more interested in seeing if there were any differences between two images not if they were equal.
But if the images are identical, then the files are also identical, just do a 'diff' on the files.
"An education isn't how much you have committed to memory, or even how much you know. It's being able to differentiate between what you do know and what you don't." - Anatole France
|
|
|
|
|
|
If you just need to know if they are exactly the same or not then you might try this:
if( img1.GetSize() == img2.GetSize() )
{
if( memcmp(img1.GetDib(),img2.GetDib(),img1.GetSize()) )
else
}
Or you could just use the GetPixelColor() function to read the individule pixels one at a time, and compare them by calling CompareColors(). That would allow you to know exactly what pixels are different.
INTP
"The more help VB provides VB programmers, the more miserable your life as a C++ programmer becomes."
Andrew W. Troelsen
|
|
|
|
|
Hi,
I've wrote MFC dll using MFC DLL wizard(regular dll using shared MFC dll).
in my dll there is the declaration:
#define TCPDLL_API __declspec(dllexport)
TCPDLL_API int FLRInitializeIP(IPStruct *Server,int num_of_radars);
in my dll.def there is the declaration:
FLRInitializeIP @1
and the implementation is as follow:
TCPDLL_API int FLRInitializeIP(IPStruct *Server , int num_of_radars)
{
struct hostent *Host;
SIZE_T t=100;
char *host_name = new char[100];
gethostname(host_name,t);
Host = gethostbyname(host_name);
Server->HostIP = inet_ntoa(*((struct in_addr*)Host->h_addr));
delete []host_name;
Server->Num_Of_Connected_Clients = 0;
Server->ListeningSocket = INVALID_SOCKET;
Server->Num_Of_Radars = num_of_radars;
if(CreateTCPServerSocket(Server) != LISTEN_SUCCESS)
return 0;
return 1;
}
now,in my application i'm using the dll like this:
typedef int (CALLBACK* FLRInitializeIP_PROCCESS)(IPStruct* ,int);
void CDLLTestDlg::OnListenButton()
{
HINSTANCE hLib;
FLRInitializeIP_PROCCESS FLRInitializeIP;
IPStruct Server;
int result;
hLib = LoadLibrary("TCP_DLL.dll");
FLRInitializeIP = (FLRInitializeIP_PROCCESS)GetProcAddress(hLib,"FLRInitializeIP");
result = FLRInitializeIP(&Server , 1);
m_List.AddString(Server.HostIP);
FreeLibrary(hLib);
}
if,in my application 'the return type is "void" so there is no problem.
But,if the ruturn value is anything else than void,i gets an error.
what i'm doing wrong?
Helpppppppppppppppppppp
Regards,
Eli
|
|
|
|
|
I would first like to mention that your specific problem has nothing to do with the MFC DLL. You have the same problem if it was a regualr' NOn-MFC' DLL.
You need to make the function signatures match the pascal calling convention.
I usually give all regular 'C' functions exported from a DLL the pascal calling convention, unless otherwise required. One exception, for example, is if the function has a variable number of arguments.
Especially since you declared that the function has this signature:
typedef int (CALLBACK* FLRInitializeIP_PROCCESS)(IPStruct* ,int);
And in WTYPES.H there is this definition:
#define CALLBACK FAR PASCAL
You need to define the function ion the DLL with the same signature, like this:
#define TCPDLL_API __declspec(dllexport)
TCPDLL_API int WINAPI FLRInitializeIP(IPStruct *Server,int num_of_radars);
TCPDLL_API int WINAPI FLRInitializeIP(IPStruct *Server , int num_of_radars){
|
|
|
|
|
Hi,
First - thanks for your prompt reply.
well,i'v tried your suggestion,but it's still give me run time error(something about convntion - as you said).
Here is what i did:
Instead of :
TCPDLL_API int FLRInitializeIP(IPStruct *Server,int num_of_radars);
I've wrote :
TCPDLL_API int WINAPI FLRInitializeIP(IPStruct *Server,int num_of_radars);
and instead of :
TCPDLL_API int FLRInitializeIP(IPStruct *Server ,int num_of_radars)
{
struct hostent *Host;
SIZE_T t=100;
char *host_name = new char[100];
gethostname(host_name,t);
Host = gethostbyname(host_name);
Server->HostIP = inet_ntoa(*((struct in_addr*)Host->h_addr));
delete []host_name;
Server->Num_Of_Connected_Clients = 0;
Server->ListeningSocket = INVALID_SOCKET;
Server->Num_Of_Radars = num_of_radars;
if(CreateTCPServerSocket(Server) != LISTEN_SUCCESS)
return 0;
return 1;
}
I've wrote :
TCPDLL_API int WINAPI FLRInitializeIP(IPStruct *Server ,int num_of_radars)
{
struct hostent *Host;
SIZE_T t=100;
char *host_name = new char[100];
gethostname(host_name,t);
Host = gethostbyname(host_name);
Server->HostIP = inet_ntoa(*((struct in_addr*)Host->h_addr));
delete []host_name;
Server->Num_Of_Connected_Clients = 0;
Server->ListeningSocket = INVALID_SOCKET;
Server->Num_Of_Radars = num_of_radars;
if(CreateTCPServerSocket(Server) != LISTEN_SUCCESS)
return 0;
return 1;
}
Now,when I'm debugging my code - the function works well and the run time
error accurs after the :
return 0;
or
return 1;
So,where is the problem???
Again - thanks for your help.
With best regards,
Eli
|
|
|
|
|
I am not sure. Usually when you crash on a 'return' from a function it is because your stack has been corrupted. Perhaps something done inside CreateTCPServerSocket is the culprit.
I am also suspicious of this line
Server->HostIP = inet_ntoa(*((struct in_addr*)Host->h_addr));
because if the Server->HostIP is only a pointer to a string and not the buffer itself, you might be losing the string because of this warning from MSDN regarding the string returned from inet_ntoa:
The data is guaranteed to be valid until the next Windows Sockets function call within the same thread—but no longer. Therefore, the data should be copied before another Windows Sockets call is made.
I think you should check this string assignment, and make sure it is COPYING the string and not just assigning the address, and also look into CreateTCPServerSocket to make sure it does not overwrite some local variables that would be resulting in the corrupted stack.
|
|
|
|
|
Me: looking to fill C++/Linux and TCP/IP programming position in NYC.
You: Fantastic programmer looking for interesting position in NYC.
Please send me a resume.
|
|
|
|
|
Are you sure that this is the right website for linux job offers?
It's a windows site
Don't try it, just do it!
|
|
|
|
|
|
|
Me: looking to fill ______programming position in NYC.
You: Fantastic programmer looking for interesting position in NYC.
Please send me a resume.
|
|
|
|
|
Hello. I need help.
The question is... I want to move all row. From row 10 to row 4 using a Drag Drop.
How can I do it?
Thanks
Xavier
|
|
|
|
|
Hi Forum,
i need help by retriving the current user password, in my application user can create a task to schedule, but i dont want that the user inputs him password and name, this should be comming from the funktion, the user name i get with the GetUserName() method but i need hims password to create a task! Is that any known method for this? method NetUserGetInfo() retrives me a empty string so i can't take it, example :
NetUserGetInfo( NULL, user_name, 1, (byte **) &info );
CString strUserPassword = info->usri1_password;
strUserPassword is empty now!
thanx for help
mirsad
|
|
|
|
|
ähm, im not Anonymous, its my posting,
mirsad
|
|
|
|
|
You have to ask the user for his password.
For security purposes, there is not a readily available API to retrieve the user's password. Else every trojan, worm, and virus out there would be using it.
|
|
|
|
|
|
thanx for answers,
for example, when i create a task for my antivirus programm to start every day in 00:00 time, i dont need a passwort, and the task is valid, that is because i thing that is possible, and i know, a new task whitout a USERNAME and PASSWORD will NEWER start, how is that possible?! that is thrue! So i look for a new solution to create a new task whitout a needs to user inputs him's password! The username is not a problem! There must be a way to due this, the people from symantec due the same
thanx
mirsad
|
|
|
|
|
Actually Power Behind Symantec Anitvirus is that it's running it's scanning engine as a Window Service(which run on Administrative Priviledge)
keep smilling.....b'coz smile is the shortest distance between people....
|
|
|
|