|
|
Hi,
Thanks for the quick reply, worked like a treat. Now I need to work out how to send information to another window. I can get the HWND of the instance by using ::FindWindow() but what's the Windows way of sending information to another process? i.e. If I double-click a file associated with my program I want to use the previous instance to open it.
I tried sending a WM_NOTIFY to it, but obviously it won't work since I can't send any information across.
Thanks in advance.
|
|
|
|
|
Try WM_COPYDATA
Pssst. You see that little light on your monitor? That's actually a government installed spy camera. Smile and wave to big brother!
|
|
|
|
|
It worked like a treat, thanks for all the help!
|
|
|
|
|
So, my co-worker and I are converting a major library to be UNICODE compatible. Now I can see specific file streams like ifstream and wifstream that are specific to single byte strings and wide character strings.
My question is, Is there a generic file stream that will compile to the appropriate character type, depending on your settings? A bit like how TCHAR will compile as a char, or a wchar_t if in UNICODE.
If there is for the file stream, is there a generic one defined for the string class as well?
I Dream of Absolute Zero
|
|
|
|
|
|
ifstream and wifstream (like all C++ stream and string classes) are char and wchar_t variants of
basic_ifstream< CharT, CharTraits = std::char_traits< CharT > >,
where CharT is the character type and CharTraits is a specialization of std::char_traits< CharT >, or a compatible class.
Therefore, you can have:
typedef std::basic_string< TCHAR > _tstring; // TCHAR string!
typedef std::basic_ifstream< TCHAR > _tifstream; // TCHAR input file stream
class std::char_traits< Unicode >{ ... }; // pseudo-code
typedef std::basic_ifstream< Unicode > uifstream; // Unicode input file stream
or
class UnicodeTraits{ ... }; // char_traits-like class
typedef std::basic_ifstream< Unicode, UnicodeTraits > uifstream2;
Note that the file path is const char *, so this will not support wide/Unicode paths.
HTH
Reece Haston Dunn
Software Engineer, Sophos
Web: www.sophos.com
Sophos - protecting businesses against viruses and spam
|
|
|
|
|
The Createinstance method is not working properly.It does not return
the handle what is the problem ..?
DG
|
|
|
|
|
I hope it will work..
CLSID clsid;
HRESULT hr;
here u possed application with interface...
hr=CLSIDFromProgID (L"Word.Application", &clsid);
if (hr!=S_OK)
AfxMessageBox(":failed to get the clsid");
// Create an instance of the Word application and obtain the pointer
IUnknown* pUnk;
IDispatch* pDispApp=NULL;
hr = ::CoCreateInstance( clsid,
NULL,
CLSCTX_SERVER,
IID_IUnknown,
(void**) &pUnk);
// Query IUnknown to retrieve a pointer to the IDispatch interface
hr = pUnk->QueryInterface(IID_IDispatch, (void**)&pDispApp);
ASSERT(pDispApp);
Thanks,
Anji.Manchikanti
|
|
|
|
|
Hi,
Better Register Dll using Regsvr32 and then use
CoCreateInstance for creating a COM instance.
|
|
|
|
|
The Createinstance method is not working properly.It does not return
the handle what is the problem ..?
DG
|
|
|
|
|
I'm quite experienced with MFC and MFC's "templatized collections". However, I'm writing an ATL server and need to track a map of client connections. I'd like to do this via a handle (actually a GUID) that I return to successfully connected clients. Therefore the map will be Handle-To-ConnectionObj. How is this done via ATL?
|
|
|
|
|
I've not used VC++ 7 but a casual look at the Help shows that there are a number of sample applications that illustrate using the collections. I assume you're using VC++ 7?
Kevin
|
|
|
|
|
Hi,
Any one know "How to develope old db provider in vc++ by ATL" help me...
thanks
Thanks,
Anji.Manchikanti
|
|
|
|
|
I'm having a CRichEditView for a long time in my code and suddenly the backcolor when typing something in the view is black....??like a square black around each letter I'm typing??
I patched it by doing a charformat in the OninitialUpdate
CHARFORMAT2 cf2;
m_editCtrl->GetDefaultCharFormat(cf2);
cf2.dwEffects = 0;
cf2.crBackColor = ::GetSysColor(COLOR_WINDOW);
SetCharFormat (cf2);
but when I'm doing an undo the black backcolor coming back and with the letter BOLD and with the letter higher than when I setted it at star....????
I overloaded functions OneditUndo and OnEditRedo and by writing the same code.
It works but it's not really nice...
Is there anybody who had that same problem??
|
|
|
|
|
can anyone briefly explain me about .NET porting ?
What are the significant changes need to be done after porting a VB application to VB.NET?
|
|
|
|
|
ATL, WTL and STL are all template libraries in C++. Why did you ask this question here ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I have a BHO vs c++ project working!
I can write code in the DISPID_BEFORENAVIGATE2 of the invoke, or use the IWebBrowser. What I want to do is add my own http header attribute to every request going from the browser.
How can I do that?
|
|
|
|
|
I develop a tree control, it is displaying the drives and folders. In WTL the following two handlers are not working simultanously.
REFLECTED_NOTIFY_CODE_HANDLER(TVN_ITEMEXPANDING, OnItemExpanding )
MESSAGE_HANDLER(WM_LBUTTONDOWN,OnLButtonDown)
If i write the OnLButtonDown handler OnItemExpanding is not woring.
But MFC both are working simultanously.
plz reply to me.
Thank you.
|
|
|
|
|
|
I have Made one Com Dll for doing communication with
serial port.
This Dll contains all the funtions for communication
with Serial port.
and i am having one application which is having
2 threads..
and
These 2 threads continously calling the functions
of dll.so is there any need of syn.in side the dll
for communcating with comport..
because
for example my first thread calling one fun. of dll
and if it transmits the data and now it is waiting
for response getting data from serial port.At the
same time if my second thread call the same fun.
of dll then what happnes it will be called after
finishes first or it is called and creates the
problem in getting response of app. funcaiton
calling..means i want to know that
syn. is this handle by automatically com dll or have to
give some extra provistion for this ??
|
|
|
|
|
I have Made one Com Dll for doing communication with
serial port.
This Dll contains all the funtions for communication
with Serial port.
and i am having one application which is having
2 threads..
and
These 2 threads continously calling the functions
of dll.so is there any need of syn.in side the dll
for communcating with comport..
because
for example my first thread calling one fun. of dll
and if it transmits the data and now it is waiting
for response getting data from serial port.At the
same time if my second thread call the same fun.
of dll then what happnes it will be called after
finishes first or it is called and creates the
problem in getting response of app. funcaiton
calling..means i want to know that
syn. is handle by automatically com dll or have to
give some extra provistion for this
|
|
|
|
|
It depends how you have CoCreated the com component in your appllication. If you are sharing single com object between two threads then you definetly need sync code in your application. And sharing com object between two threads needs special sync mechanism
But I guess if you have seperate com objects in each thread then you may not need any synchronization code.
|
|
|
|
|
|
It's just a simple macro
#define STDMETHOD(method) virtual HRESULT STDMETHODCALLTYPE method
What do you not understand about it?
|
|
|
|