|
Hmmm, thanks a lot for the tip. I'll do that.
|
|
|
|
|
I'm trying to broadcast a message using this:
<br />
::SendNotifyMessage(HWND_BROADCAST, WM_MYMSG, 0, 0);<br />
If another app, I've got a handler in my CMainFrame class that handles that message, like so:
In the header file:
<br />
protected:<br />
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);<br />
afx_msg LRESULT OnReadyRemote(WPARAM wParam, LPARAM lParam);<br />
DECLARE_MESSAGE_MAP()<br />
And in the CPP file:
<br />
LRESULT CMainFrame::OnReadyRemote(WPARAM wParam, LPARAM lParam)<br />
{<br />
wParam;<br />
lParam;<br />
AfxMessageBox("Kicker Ding");<br />
return 1L;<br />
}<br />
The message is registered like so (in a common header file used by both apps):
<br />
----------------------
I'm fairly certain that the app braoadcasting the message is actually doing so, but I know for a fact that the other app isn't seeing it.
Anyone have any ideas?
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
"You won't like me when I'm
|
|
|
|
|
Are you missing:
ON_REGISTERED_MESSAGE(WM_MYMSG, OnReadyRemote); in the message map?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
ON_MESSAGE won't handle a registered message?
I'll give it a go.
------- sig starts
"I've heard some drivers saying, 'We're going too fast here...'. If you're not here to race, go the hell home - don't come here and grumble about going too fast. Why don't you tie a kerosene rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt
"...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
"You won't like me when I'm
|
|
|
|
|
John Simmons / outlaw programmer wrote:
ON_MESSAGE won't handle a registered message?
If it did, I suppose there would not be much need for ON_REGISTERED_MESSAGE() .
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Could someone please help with marshalling to .NET. I posted this question here, not in C#, 'cause I know for sure the mistake is somewhere in .idl or cpp file.
I have a Win32 C++ project with the following three files:
//tlbsamp.cpp///////////////////////////////////////////////////
#include <windows.h>
interface ITest{bool MyFunc();};
class Test:public ITest{
int i;
public:
Test(){i=10;}
int MyFunc(){return i;}
};
ITest* __stdcall MyDll_CreateTest(){
return new Test();
}
int __stdcall MyDll_CreateInt(){
return rand();}
BOOL APIENTRY DllMain( HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved )
{return TRUE;}
//tlbsamp.def//////////////////////////////////////////////////////////
LIBRARY TLBSamp
DESCRIPTION 'Sample DLL'
EXPORTS
MyDll_CreateTest
MyDll_CreateInt
//tlbsamp.idl/////////////////////////////////////////////////////////////
import "oaidl.idl";
import "ocidl.idl";
[ uuid(983EE63A-7FB0-494a-AD63-14F48347DB7A), lcid(0x0409), version(1.0) ]
library TLBSample
{
[object,uuid( 1F707072-05C6-4501-AD74-CFD57AB8002C)]
interface ITest:IUnknown
{int MyFunc ();}
[ version(1.0), dllname("TLBSamp.dll")]
module MyDllFunctions
{
[entry("MyDll_CreateTest")]
ITest* __stdcall CreateTest();
[entry("MyDll_CreateInt")]
int _stdcall CreateInt();
} };
I am compiling the project and get tlbsamp.dll ,tlbsamp.tlb, tlbsamp.lib, then I create a c# project, AddReference->COM->
Browse, all the .tlb file. In object browser I can see my ITest interface with MyFunk function. Here's the c# code.
using System;
using System.Runtime.InteropServices;
using TLBSample;
namespace Test_Call_MSDN_Dll
{
class Class1
{
[DllImport(@"E:\MyProgs\NET\TLBSamp\debug\tlbsamp.dll")]
public static extern TLBSample.ITest MyDll_CreateTest();
[DllImport(@"E:\MyProgs\NET\TLBSamp\debug\tlbsamp.dll")]
public static extern Int32 MyDll_CreateInt();
[STAThread]
static void Main(string[] args)
{
Console.WriteLine(MyDll_CreateInt().ToString());//OK-works fine
ITest spClass=MyDll_CreateTest();//ExecutionEngineException(???)
Console.WriteLine(spClass.MyFunc().ToString());
Сonsole.Read();
}
}
}
What am I doing wrong?
Thanks in advance!
|
|
|
|
|
Ick. I don't think the P/Invoke and COM marshallers work well together. Use one or the other, but not both.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I copied a project over to another directory in VC 6.0, and I had some trouble with it not recompiling so I hit rebuild all. Now ALL the IDE will do is recompile - it is ignoring the precompiled headers, and rebuilding every single time. Is there a directory pointer that may be misplaced? Anybody encountered this problem before?
|
|
|
|
|
The only time I have seen this is if the date/time of the file is after the current date/time.
Can be encountered when you save files and alter the clock backwards!!
Ant.
|
|
|
|
|
Yep - that was it, thanks for the help.
|
|
|
|
|
All I want is the ability to share data between a DLL (Loaded dynamically) and a EXE application.
I have tried the shared data segment - no good (only for instances of the same program). Works with 2 EXEs - tried it today.
Next I tried Mailslots, but the Mailslot (Server) need to be in the DLL, so how does it read the Mailslot and how do you arrange for it to be created as no Entrypoint in the DLL.
I did try and arrange when one of the functions wa called it would first setup the Mailslot, but never managed to have the Client attach to it.
They must be a simple way to have 3 interger values shared between this EXE and DLL.
Been on the problem all day now!
Help!!
|
|
|
|
|
|
Just to elaborate a bit on what Michael said, what I would do is define a data structure that will contain your shared data. Then write a function that will return a pointer to the shared data. Within that function use the implemention that Michael described. I have used this technique many, many times and it is very easy.
__________________________________________
a two cent stamp short of going postal.
|
|
|
|
|
I have already define a simple structure for the data (3 integers and a 80 char string).
I have used Mailslots (hence the structure already defined) and Sockets, but never used File Mapping before. Any simple examples?
I have seen some but wapped up with other IPC stuff. Also never used the GUID before.
regards,
Sweep.
|
|
|
|
|
Here are two :
http://www.codeproject.com/threads/csharedstruct.asp
http://www.codeproject.com/threads/sharedmemipc.asp
Good luck.
__________________________________________
a two cent stamp short of going postal.
|
|
|
|
|
Thanks Rick. I had already found your first link last night and got it working before the e-mail came through.
You were right, quite simple to implement.
Sweep.
|
|
|
|
|
right well i installed visual studio on my home pc so that i could run my c++ pojects and now when i surf the internet some pages bring up an error window and make a really annoying noise and ask me if i want to debug the page, im sure someone knows what im talkin about, how do i stop this, its so head melting
thanks
colum
|
|
|
|
|
Go in IE to Tools->Internet options->Advanced
Then click Disable Script debugging
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
ah yes now thats what im taking bout, fast accurate reply's... thanks a lot
|
|
|
|
|
I have the following code that reads all the messages currently in the user's inbox and inserts them into a listview. I'm using automation and everything seems to be working fine except for getting the sender's email address. There's a property for getting the sender's name, but not the email address. here's the code I have so far. Hope anyone can help!! Thanks!!
void COtestDlg::OnRun()
{
MapiMessage mm;
MAPIFolder folderInbox;
_NameSpace ns;
_Items itemsMessages;
_MailItem mi;
_Application app;
if(!app.CreateDispatch("Outlook.Application"))
{
AfxMessageBox("Couldn't start Outlook.");
}
else
{
ns = app.GetNamespace("MAPI");
COleVariant vt;
COleVariant vtOptional("");
COleVariant vtTrue;
vt.ChangeType(VT_BOOL);
vt.boolVal = true;
vt.ChangeType(VT_I2,NULL);
ns.Logon(vtOptional, vtOptional, vtTrue, vtTrue);
folderInbox = ns.GetDefaultFolder(6);
itemsMessages = folderInbox.GetItems();
for (int x = 0; x < itemsMessages.GetCount(); x++)
{
mi = itemsMessages.Item(COleVariant((long) x + 1L));
m_lvwResults.InsertItem(x,mi.GetSenderName());
m_lvwResults.SetItemText(x,1,mi.GetSubject());
m_lvwResults.SetItemText(x,2,mi.GetBody());
}
ns.Logoff();
}
}
If it's broken, I probably did it
bdiamond
|
|
|
|
|
|
Yes, that worked perfectly, thanks!!
If it's broken, I probably did it
bdiamond
|
|
|
|
|
Topic says it all, how can I transform a jpg to a bmp in C++?
|
|
|
|
|
|
Hello,
I have two programs that I have to use one after another. The first one's goal is to configure data you use with the second. So I have to leave the first to use the second. And if I want to change the configuration, I have to quit the second to return in the first one, change the configuration. Then I can quit the configuration program and come back in the second program.
So this is very fastidious because I always have to do the same thing twice (I always have to change the configuration once, and this is always the same thing)
I don't have the source code so I cannot modify it
So my question is (finally...) is there a way to do a program that runs other programs and that modifies comboboxes and stuff the way a REAL user could do it?...
Thank you in advance
If someone did not understand what I meant please tell me too
an allarc'h zo bet
|
|
|
|