|
Do you know how i can make a plugin for internet explorer or at least give me some resources or docs. I can't find any good reference for the internet explorer API. I think i need to learn some more about COM or ActiveX but I'm not sure what. I need to know how to make a plugin for IE so I can browse a remote filesystem through an ActiveSync connection.
thanx.
|
|
|
|
|
Look for Browser Helper Object (BHO).
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Membership in Thread is defined by object or by method ? -
If I call method of object from one thread,
will other object's methods be blocked from other thread,
in MFC ?
This is apartment threaded library ?
Thanks
|
|
|
|
|
Unless you're going through COM, there is no synchronisation between threads. If going through COM (i.e. one object is created using CoCreateInstance ), a proxy may be added by COM if the threading models don't match.
You should perform your own synchronisation wherever needed.
|
|
|
|
|
Hi All,
I am new to the VC++ development.
I am using the Word Object Library in Visual Basic,
Now I wanted to do the same in VC++.
I want to use it in console mode.
May you give me guidance to do the same.
Thanks.
GTS
|
|
|
|
|
Check out MSDN article Q178749.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi David,
You showed the perfect start place.
Thanks.
GTS
PS - 5 birds left, 3 of them only decided not fly away yet.
|
|
|
|
|
Hey all,
Im new to C++ and MFC and am trying to write a chat program for direct IP connections via TCP/IP.
For that I derived a class from CAsyncSocket, createt an Instance (m_ConnectSocket) and can now send CStrings via
m_ConnectSocket.Send(Data, Len) and receive them with
m_ConnectSocket.Receive(Buffer, BufferSize)
1.How can I now send and receive different variables...and distinguish them?
I just dont know how to use some kind of flag.
2.Also I would like to know how to get the Length of other objects...e.g. if i want to send a whole struct or Instance of another class.
Please help me
|
|
|
|
|
Something tells me that this is not just a "chat" program since you want to "send and receive variables".
What kind of a problem are you trying to build a solution for?
(Looks like asking: "I've bought a boat. How can I make it fly?" instead of asking "I want to go to the moon. How can I get there?" )
pillepop wrote:
1.How can I now send and receive different variables...and distinguish them?
I just dont know how to use some kind of flag.
2.Also I would like to know how to get the Length of other objects...e.g. if i want to send a whole struct or Instance of another class.
This looks like you want to transfer binary data (all kinds of variables) over a TCP/IP connection. Take a look at MSDN samples CHATSRVR and CHATTER. The messages sent could easily be altered to send binary data instead. The CMsg object sent over the TCP/IP connection contains a few variables. If you send similar objects looking like this:
class CMsg : public CObject
{
protected:
DECLARE_DYNCREATE(CMsg)
public:
CMsg();
virtual ~CMsg();
virtual void Serialize(CArchive& ar);
DWORD m_dwCommand;
DWORD m_dwLength;
BYTE* m_pBinaryData;
BOOL m_bClose;
}; you could send just about anything across the connection, including structures as long as the receiver knows how to interpret the data by reading the m_dwCommand value.
If this is not what you are after: forget the whole thing above!
If this is your problem I hope this helped or maybe you should have a look at DCOM where you create a component on a different machine and communicate with it through an interface via RPC (TCP/IP).
But that's a different ball game!
If you are interested in DCOM there are very useful articles here at CodeProject.
--
Rog
|
|
|
|
|
thanks for the answer
Hehe, good point.
Actually I started off building a chat-prog... and am now trying to enhance it a bit
First thing I meant was: I have 2 edit boxes whose contents are sent 2 the receiver, who then in turn has to show them again in different edit-boxes.
... doesnt this work with the normal send() and receive() function?
Well, and furthermore i want to transmit several integer ... as struct or whatever. That a bit more specific?
It might be a stupid question, but do I need .net for the MSDN samples? Unfortunately I cant open the .sln (got vc++)
|
|
|
|
|
Here's a good hint from writing software. Always do your best to seperate your UI from your back-end.
Your issues of how to display stuff is one thing, but what you actually intend to do here is: post a interpretable message from one client to another. Most chat programs do this by either using a specific packet/message format -- or use some "RPC".
Ignore the RPC for now.
What I think you need to do, is define a message format. This message format is something used by one client to convey one of many possible messages to another client.
The message that you want to send needs to be able to contain:
* identification of what type of message you are sending
* its good to include the size of the whole message
* and the "message" itself.
I should say, that my use of the word "message" should not be confused with a "chat message". This is a broader term for any bit of communication from one client to another.
In instant messaging, these messages are commonly:
* "instant message"
* "i want to log in and here's my password"
* "i am logging off"
* "here's a file"
* "i am away"
stuff like that.
You might consider XML as a nice and easily interpretable way to send messages.
But more often than not, the "message" is sent a data block.
Here's a possible message format -- this is a "message header";
[Message-Type: stored as a DWORD]
[Message-Length: stored as a DWORD]
With this information, you can now interpret the packet/message to determine what the caller wants to tell you. Message-Type of (3) might mean that you are "away". and a (6) might mean "i want to transfer a file".
Depending on the message ID, the data that follows will be in the format appropriate to that message type....
I'll leave you with this -- but I hope these clues help.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
Peter Weyzen<br />
Staff Engineer<br />
<A HREF="http://www.santacruznetworks.com">Santa Cruz Networks</A>
|
|
|
|
|
Hi,
can anyone help how to create a Menu dynamically in a MFC application ?
Thanks in advance
ram
|
|
|
|
|
|
The AppWizard-generated class for your main window is named CMainFrame and it's derived from CFrameWnd. CFrameWnd, in turn, is derived from CWnd, and CWnd has a bunch of easy-to-use member functions like SetMenu(). Play around with those.
|
|
|
|
|
Hi,
is there a Win32 API to check if a file is an executable (that can be passed to CreateProcess)?
IIRC there was one, but I can't remember....
"Dor säggsische Dialeggt eechnet sich wie keeen onderor für den Ausdrugg zäärdlischor Gefiehle."
sighist | Agile Programming | doxygen
|
|
|
|
|
I don't know any direct API that can be just called with filename returning true/false if it's a EXE.
This one can be a good starter - doing something different, but in fact very similar
Q90493 - HOWTO: How To Determine Whether an Application is Console or GUI
Or I would look to Image Help Library (obsolete - better use DbgHelp) might be there will be some handy functions.
hope this helps
|
|
|
|
|
|
Which would not work on files such as screen savers.
SHGetFileInfo(_T("C:\\WINNT\\system32\\ssbezier.scr"), 0, &fi, sizeof(fi), SHGFI_EXETYPE);
Would return a value of 0, indicating it is not an executable, when in fact it is.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Try this code snippet:
HANDLE hFile;
IMAGE_DOS_HEADER DosHeader;
DWORD dwBytes,
dwBytesRead;
IMAGE_NT_HEADERS NTHeader;
hFile = CreateFile(szFilename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if (INVALID_HANDLE_VALUE != hFile)
{
dwBytes = sizeof(IMAGE_DOS_HEADER);
if (ReadFile(hFile, &DosHeader, dwBytes, &dwBytesRead, NULL) != FALSE)
{
SetFilePointer(hFile, DosHeader.e_lfanew, NULL, FILE_BEGIN);
dwBytes = sizeof(IMAGE_NT_HEADERS);
ReadFile(hFile, &NTHeader, dwBytes, &dwBytesRead, NULL);
if ((NTHeader.FileHeader.Characteristics & IMAGE_FILE_EXECUTABLE_IMAGE) == IMAGE_FILE_EXECUTABLE_IMAGE)
MessageBox(_T("File is executable"), _T(""), MB_OK);
}
CloseHandle(hFile);
}
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi all
My application used 2 threads ,2 apartments more exactly. First one is main STA and second is MTA. Into main STA I create COM object , approximately this way:
Void main(){
CoInitializeEx(NULL,COINIT_MULTITHREADED);
CmyObjPtr pObj(CLSID_ CmyObjPtr);
pObj->DoSomethere();
…
}
Sometime arise distinguished trouble my object invoke itself method (ie pObj->DoSomethere();) haven’t time to be created because of it accomplished into other thread.
How I can avoid this??? I try to use a great deal of synchronized methods, for this purpose such as creating critical section in DllGetClassObject function and this code
While(pObj == NULL){
Sleep(10);
}
But program not exit from this loop if pObj don’t be created from enter into loop.
Thanks.
|
|
|
|
|
You need to use a CRITICAL_SECTION or MUTEX to force the thread not to continue until the other thread holding the MUTEX returns it. Basically wrap the initialisation up in the mutex so you know it will complete it before the component is used. MSDN will be able to help you on this, its a bit too involved to explain on the forum.
Alan.
|
|
|
|
|
Hi all,
I'm trying to add a splash screen to a dll inside DllMain (process_attach) and the docs says there are lots to think about. E.g I can not call functions outside kernel32.dll, etc...
Now I need to know where I can find a table of all functions listed in kernel32.dll? Anyone?
The docs also says I can not call any registry functions... by if I want to do this, how can I go on?!
/Tommy
|
|
|
|
|
if you mean name of this function then you can use Depends application from VC tools.
|
|
|
|
|
The reason for the restriction is that you don't know what order the loader will decide to initialise DLLs in, and you shouldn't use any DLL that hasn't been initialised.
The only DLL it's always safe to use at this point is kernel32.dll, because that's where the Win32 bit of process setup lives - it's guaranteed to be initialised first.
A large amount of the GUI code lives in User32.dll and Gdi32.dll, so you shouldn't do what you're proposing to do. If you must do it, delay it until some other function in your DLL is called. Personally I would advise not doing it at all.
For information on how the .NET Framework breaks these rules, and the impact that has, read Chris Brumme's blog entry[^] on the subject.
|
|
|
|
|
Tommy Svensson wrote:
Now I need to know where I can find a table of all functions listed in kernel32.dll? Anyone?
Depends.exe
dumpbin /exports
are two that I know of.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|