|
Thanks for your reply.
Now I am using WM_COPYDATA to send string to my other application. I also want to send 2 integer values with this string. So, I made a structure of 1 string and 2 integers. But on the other side I am able to get 2 integer values but not string. I get blank string on that side. Here I am sending my code.
Sender application
struct MYDATASTRUCT
{
LPCSTR myString;
int myX;
int myY;
};
MYDATASTRUCT myStringData;
myStringData.myX = X;
myStringData.myY = Y;
myStringData.myString = lpString;
COPYDATASTRUCT myData;
myData.dwData = 0;
myData.cbData = sizeof(myStringData);
myData.lpData = &myStringData;
::SendMessage(g_mainHwnd,WM_COPYDATA,NULL,(LPARAM)&myData);
Receiver application
PCOPYDATASTRUCT myData = (PCOPYDATASTRUCT)lParam;
MYDATASTRUCT* myStringData = (MYDATASTRUCT*)myData->lpData;
int X = myStringData->myX;
int Y = myStringData->myY;
LPCSTR lpString = myStringData->myString;
Now when I am sending this string directly without structure and integer value I am able to get that string on receiver application.
Can anyone find what is the problem with structure code?
Thanks,
Priyank
|
|
|
|
|
Actually I made an API Hook DLL to hook any application for ExtTextOut() winapi. Now when my DLL get this api call I need to process string in my other application. But I am not able to send or post this string to my application. Any suggestion how can I get this string in my application?
Thanks,
Priyank
|
|
|
|
|
I have seen in a couple of places a mention by Microsoft that WMI Performance counters are only a Windows 2K technology. Is this really true? If it is, what are we supposed to use going forward?
¡El diablo está en mis pantalones! ¡Mire, mire!
Real Mentats use only 100% pure, unfooled around with Sapho Juice(tm)!
SELECT * FROM User WHERE Clue > 0
0 rows returned
Save an Orange - Use the VCF!
|
|
|
|
|
I have a few singleton classes which I would like to be truely single. i.e. I only want one instance between processes, users and sessions. I have found many articles on multithreaded singletons, but this does not address the memory scope problem. I could use a mutex to check for another instance, but what is the best way to share an instance?
|
|
|
|
|
There could be various solutions to this problem.
Preferrably using mutex's .
something like
HANDLE hMutex;
hMutex = CreateMutex(
NULL, // no security attributes
FALSE, // initially not owned
"SomeUniqueName"); // name of mutex
If this exists already return from the application.
Another option would be to use a shared variable and check for its value. Increment it each time an instance is created. If the value is greater than one you can just return from the second instance.
The third option would be to use the FindWindow function. You would get the handle to the window if it's already running.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Sorry if I didn't make it clear in my post. I am not talking about a single instance of an application, but infact a single instance of a class which is to be shared amongst multiple instances of an application.
|
|
|
|
|
waldermort wrote:
Sorry if I didn't make it clear in my post. I am not talking about a single instance of an application, but infact a single instance of a class which is to be shared amongst multiple instances of an application.
look for com classes!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Thankyou, that has put me back on the right track
|
|
|
|
|
this is definitely a Copy/Paste of your previous answer... you didn't read the question
|
|
|
|
|
You need some form of inter-process communications for that solution. There are numerous techniques for that so currently your question is way to broad.
"I've found that the shortcomings of human nature have little to do with nationality." Christopher Duncan in the Lounge
led mike
|
|
|
|
|
Hi WalderMort !
Your question is very interesting. I have the same problem with my application.
One of the possible solution is to define class as global, and then to use directive "extern" to get access to his members from any other part of your application.
I am using this method, and it work just fine.
|
|
|
|
|
Lambry wrote: One of the possible solution is to define class as global, and then to use directive "extern" to get access to his members from any other part of your application.
you can't share data between two exe.. using that method!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Well ... Alok Gupta, may be I understand question of WalderMort in deferent way, but tell me where in the sentences of that post is talking about different *.exe's ?
|
|
|
|
|
|
Thank You Alok Gupta !
In this case I only can tell:
- How to help to person (like WalderMort) that even cant ask a question in a right way? I am sorry that I lost my time, for nothing. And in addition your time Alok, and lot of space here in Code project.
|
|
|
|
|
Lambry wrote: How to help to person (like WalderMort) that even cant ask a question in a right way?
actually.. here knowledge of langauge is problem... actualy people sometime fails to express there problem.. that doesn't mean they are good programmer.. you don't need to be sorry.. actually i posted after reading evrybody comments.. there fore.. might be i commented over your statement.. anyways i am sorry.. if i am rude!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
hi,
i am working as a VC++ devloper.i want to write a method in the doc .which will call the method in the view.can i do like this?plz help me.
|
|
|
|
|
I can almost guarantee this is not how you want to organize this. What exactly are you trying to accomplish (that is, what is being done to the View that you think you want the Document to initiate it?)
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
ramanand_bulusu wrote: ant to write a method in the doc .which will call the method in the view.can i do like this?plz help me.
GetDocument api will work!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
ThatsAlok wrote: GetDocument api will work!
there is no such API called GetDocument.
I again confirmed it from MSDN for my surety.
It is a member function of CView class
Tanvon
the brain behind ...
I Blog here
|
|
|
|
|
Tanvon wrote: there is no such API called GetDocument.
I again confirmed it from MSDN for my surety.
It is a member function of CView class
Isn't i know that.... GetDocument itself imply that it will retrive the pointer to the document class associated with view... isn't are anybody using WIn32 to simulate DOC-View architecture....i believe no..
and tell me what is MFC?.. a thin wrapper over win32!.
here what actual coding of GetDocument gives
_AFXWIN_INLINE CDocument* CView::GetDocument() const
{ ASSERT(this != NULL); return m_pDocument; } Actually many people here doesn't think what is api and what is funtion....
like for Example if you use FindWindow() it is api... and CWnd::FindWindow() it is function..
but if you refer them ... you will use this api or that api... what is api at end a function which providing
application programming interface
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
Actyally I have also some unix, Linux background.
And another matter is that I also studied many operatin systems.
And that all things tell, that an API is an
interface which an operating system provides to the outside
world. So in that context every direct function in an operating system
is an API. Actually an API provides an interface for applications programs.
And that way application programs can interact with the operating system.
And libraries comes at a second stage. These libraries also provides us ways to
interact with them, they sometimes also called APIs, but it is not an
approperiate word for that purpose.
Tanvon
the brain behind ...
I Blog here
|
|
|
|
|
this is not a good practice, You should not call a particular view from a document, because it makes document to depend on a specific view, And document view articture tells us that we may have multiple view,and documents so we should not make decument to depend on a specific view.
You can do so
1: call UpdateAllViews() from your document, with a hint.
2: this will call OnUpdate() in all views (if more than one)
3: in OnUpdate in your view class watch that specific hint and call that view class method you want to call
Tanvon
the brain behind ...
I Blog here
|
|
|
|
|
Hi,
I have a win98 system and I am in need of being able to read the partition table. I'm not sure if this is specificaly a c++ question, but I am writing the code in c++. I've looked up DeviceIoControl(...), which has a IOCTL_DISK_GET_PARTITION_INFO_EX control code. That would be awesome, except it is only supported in win2k/XP systems.
In win98 you have to use VxD and DOS interupt functions with DeviceIoControl(...). Again that would be fine, but I haven't been able to find an old dos int. that will give me the partition table. Does anyone know of one, or know a better way to do this? Thanks.
-(not so epic)yeti
|
|
|
|
|
Hmm. From memory,
Int 13h is the Disk I/O one, and you'd want the first sector of the relevant disk, which should be where the MBR and partition table is.
ax = 0x0201
cx = 0x0001
dx = 0x0080 (1st HDD, 2nd = 0x81 etc)
es:bx is data buffer
CF (carry) set if an error occurred.
Disk sector should be 512 bytes.
Win9x might need you to 'lock' the volume using an Int 21h call, but I can't remember the details, since all this is so old....
Steve S
Developer for hire
|
|
|
|