|
You can always create a resource DLL, you can find articles on the internat about that.
Also you can use two projects in the same workspace and one of the projects can have the fnctionality you want to share, the most interesting way to proceed would be the DLL as in that case you can change the DLL without having to rebuild everything and you can get an upgrade...
Hope this helps.
|
|
|
|
|
Thanks for the info. However, one more question: Do I need to worry about my resource ID's in the DLL to make sure they are not the same as other resources used in the application that uses the DLL?
LA
|
|
|
|
|
|
I know how to get it with commands "netsh ipsec static show all"
but i don't know how to get the settings with c++ or windows API
X|X|X|X|
|
|
|
|
|
As part of a Licencing Setup Program, I create Exe File immages on a remote Target drive, and try to execute.
Which of all the flavours of the various api's to do this will cause the code to execute on the target machine. (I am looking for a CPU Id. Sofar I'm getting the CPU Id from the Machine I launched from.)
More Precisely, the Code I inject on the remote machine intends to find the Hardware Serial Number of the Drive, and would do so if it ran on That machine. I find every time that it finds quite successfully the hardware serial number of My Own Drive, meaning that my invocation made it run om My Machine. I Well understand that there are security issues attached to this. However, it is assumed that I have full administrator level access to All Machines involved. (I tested it on my own LAN with the above results).
Bram van Kampen
|
|
|
|
|
I am using some code to develop an Autoplay handler based on this application note.
http://msdn2.microsoft.com/en-us/library/bb776827.aspx
As described in this article, I would want to enable or disable the Autoplay feature by using code like this .
<br />
typedef HRESULT (*CREATEHARDWAREEVENTMONIKER)(REFCLSID clsid, LPCWSTR pszEventHandler, IMoniker **ppmoniker);<br />
<br />
HRESULT RegisterComponent(IUnknown* punk, DWORD* dpwToken)<br />
{<br />
HRESULT hr = E_FAIL;<br />
HINSTANCE hinstShSvcs = LoadLibrary(TEXT("shsvcs.dll"));<br />
<br />
if (hinstShSvcs)<br />
{ <br />
CREATEHARDWAREEVENTMONIKER fct = (CREATEHARDWAREEVENTMONIKER)GetProcAddress(hinstShSvcs, "CreateHardwareEventMoniker");<br />
if (fct)<br />
{<br />
IMoniker* pmoniker;<br />
<br />
<big>hr = fct(CLSID_App, TEXT("VideoCameraArrival"), &pmoniker);</big><br />
<br />
if (SUCCEEDED(hr))<br />
{<br />
IRunningObjectTable *prot;<br />
<br />
if (SUCCEEDED(GetRunningObjectTable(0, &prot)))<br />
{<br />
hr = prot->Register(ROTFLAGS_ALLOWANYCLIENT | ROTFLAGS_REGISTRATIONKEEPSALIVE, punk, pmoniker, &_dwRegisterROT);<br />
prot->Release();<br />
}<br />
pmoniker->Release();<br />
}<br />
CoRegisterClassObject(CLSID_App, static_cast<IClassFactory *>(this), CLSCTX_LOCAL_SERVER, REGCLS_MULTIPLEUSE, &_dwRegisterClass;<br />
}<br />
FreeLibrary(hinstShSvcs);<br />
}<br />
return hr;<br />
}<br />
<br />
However I find that there is an exception occuring in this line
hr = fct(CLSID_App, TEXT("VideoCameraArrival"), &pmoniker);
The exception is as follows :
Run-Time Check Failure #0 - The value of ESP was not properly saved across a function call. This is usually a result of calling a function declared with one calling convention with a function pointer declared with a different calling convention.
I am debugging this on Visual Studio 2005 and have no clue as to why this is happenning .
help is appreciated .
Engineering is the effort !
|
|
|
|
|
I am reading c plus plus primer 4th edition in 10 chapter,there are a example TextQuery.I wanted to realizd it.I build a project TextQuery,and added TextQuery.cpp,TextQuery.h and querymain.cpp which were supplied by the book.I compiled ,there was no error.But I run it ,it showed "No input file!".That means the file of Alice_stroy was not read.I want to know how to get the correct answer.
|
|
|
|
|
While someone here may have the book, I bet many of us do not...
You may get more help if you show some code or explain what the code does.
Does this "Alice_stroy" exist? If not, does it need to? If it exists, is it
in the folder the app expects it to be?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
jianfengshxy wrote: I want to know how to get the correct answer.
You probably need to supply the correct path along with the file.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
if the app's code does not contain the file spec "alice_story", and it is a console app
(you have to type to get it started), then I guess it reads the command line to find
out what file(s) it needs to operate on, so you have to append alice_story to your command...
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
I am writting an application that utilizes non-overlapped serial communication, I am writing the application using lcc-win32. If I have a loop back connector connected to the COM port all is well, I send and recevie data, but if I unplug the loopback my application locks up. Time outs are set as shown below, my call to SetCommTimeouts returns TRUE.
lpcCOMPortTimeOuts.ReadIntervalTimeout = 1000;
lpcCOMPortTimeOuts.ReadTotalTimeoutConstant = 1000;
lpcCOMPortTimeOuts.ReadTotalTimeoutMultiplier = 1000;
lpcCOMPortTimeOuts.WriteTotalTimeoutConstant = 1000;
lpcCOMPortTimeOuts.WriteTotalTimeoutMultiplier = 1000;
Was I mistaken in my assumption that these settings would set an error if the port received no response? Just to check myself my undersatnding of overlapped/non-overlapped comm is that overlapped allows other threads to run?
Any help would be greatly appreciated by this newbie.
|
|
|
|
|
IIRC the serial driver returns data when the buffer is full or the timeout condition
is met, provided there is any data at all. Disconnecting the loopback makes sure no
data gets received, because 1) there is no more data on the data receive pin, and 2)
assuming you have hardware handshake enabled, handshaking is now off too.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
OK, based on my timeout settings I would expect a one second timeout. Can you straighten out my thinking? Does the buffer size affect timeout?
Thanks Much.
|
|
|
|
|
AFAIK, if there is no data at all, the read call does not return. The timeout
starts as soon as the first byte is received, no sooner.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Ah ha! Now my assumption becomes that I must create a comm thread, and a watchdog to terminate the thread in the event that no connection is established or at least allow the user to close the app.
Thanks very much!
|
|
|
|
|
you're welcome.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Luc Pattyn wrote: AFAIK, if there is no data at all, the read call does not return. The timeout
starts as soon as the first byte is received, no sooner.
Actually this applies only to the ReadIntervalTimeout member.
The following little test (on disconnected serial port):
...
ct.ReadIntervalTimeout = 1000;
ct.ReadTotalTimeoutConstant = 1000;
ct.ReadTotalTimeoutMultiplier = 1000;
ct.WriteTotalTimeoutConstant = 1000;
ct.WriteTotalTimeoutMultiplier = 1000;
fSuccess = SetCommTimeouts(hCom, &ct);
char Buf[0x10];
DWORD dwRead;
DWORD dwStart = timeGetTime();
ReadFile(hCom, Buf, 1, &dwRead, NULL);
DWORD dwEnd = timeGetTime();
printf("elapsed milliseconds %d", dwEnd-dwStart);
outputs elapsed milliseconds 2000 , i.e.
ReadTotalTimeoutConstant + 1 * ReadTotalTimeoutMultiplier
Probably the relatively large value of ReadTotalTimeoutMultiplier (1 second per character) chosen by OP makes the application appear hung on read request for significative number of bytes.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
You may well be right, I do not recall all the details, but several years ago (actually
on Win98( we had some trouble getting both a good response time to incoming messages and a
low overhead when nothing much was coming in.
The solution then consisted of a separate thread performing two calls, one reading a single
character (the first character of a message, with a long timeout), and one reading the
remainder of the message with timeouts set so it would return very soon when no more data
seemed to come in.
Luc Pattyn [Forum Guidelines] [My Articles]
This month's tips:
- before you ask a question here, search CodeProject, then Google;
- the quality and detail of your question reflects on the effectiveness of the help you are likely to get;
- use PRE tags to preserve formatting when showing multi-line code snippets.
|
|
|
|
|
Luc Pattyn wrote: You may well be right
Oh, I'm right for sure.
Luc Pattyn wrote: but several years ago (actually
on Win98( we had some trouble getting both a good response time to incoming messages and a
low overhead when nothing much was coming in.
The solution then consisted of a separate thread performing two calls, one reading a single
character (the first character of a message, with a long timeout), and one reading the
remainder of the message with timeouts set so it would return very soon when no more data
seemed to come in.
OMG, what a workaround!
Documentation on COMMTIMEOUTS clearly states what structure members are supposed to do, but, I know, serial communication is tricky (and on Win98 , was possibly even more tricker) and when one finds obstacles on communication his imagination may reach the apex (i.e. I can remember very weird workarounds of mine).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Hi guys
I'm guessing this is a faq so I apologise in advance.
I was going to install a splash screen into an MFC application I've written using VS2005. However, I can't find the component gallery. Is there any way I can get the splash screen or the other components?
Thanks in advance
G
|
|
|
|
|
|
Thanks Dave but have MS taken the component gallery away? If so, why?
|
|
|
|
|
I have no idea what that is. The link I provided is a gallery of components. Just look through there to find one that will suit you.
|
|
|
|
|
Not from the component gallery, but have you seen this?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello guys,
I have a TLB file and it's interface description in Delphi.
But I want to create a C++ project that uses the interfaces exported by that Program.
I extracted the TLB file from the executable and now I want to ask if there is a way to convert this TLB file to an IDL file.
Any ideas?
Don't try it, just do it!
|
|
|
|