|
Simple answer is "Yes, you can make a DLL export a class". It will tie you into only using one
compiler with that DLL, but this isn't a big restriction most of the time.
You'll want to look up __declspec(export) / __declspec(import) in the MSDN library.
But each instance (EXE / DLL) using your DLL would have a fresh "copy" of the DLL, so you would
get lots of monitors. You can do tricks to make them each refer to a single one, but that gets
a bit too deep.
This sounds like a good project for a COM object. This makes a singleton easier to implement
(look on this site for examples), and means you could use the Monitor from VC++, VB
etc.
I would also think about Event Sinks to inform interested programs of changes in the
real world stuff you are monitoring.
If you have to poll the real world to check on a change, try creating a separate thread which
wakes up at regular intervals briefly.
Good luck, as this is a non-trivial learning curve...
Your experience is the opposite of mine. I've been playing with windows for years, and only
recently had to attack an Arm board...
Iain.
|
|
|
|
|
I want to manage some of my radio buttons and some of my static texts have colored text when the dialog receive a certain message, but other controls donot.
How to do this?
thanx.
|
|
|
|
|
Take a look at CP, there are lots of articles regarding on this in the Static and into other sections...
Hope this helps...
|
|
|
|
|
What is the problem? What do you want to accomplish?
Kuphryn
|
|
|
|
|
make texts of the control or the static text have color
|
|
|
|
|
One solution is to add a handler for ON_WM_CTLCOLOR.
Kuphryn
|
|
|
|
|
Do you mean I should create a new class, inheriting from the orignal control class, for my control which I want to color its text. Then overridde the OnCtlColor function of the class, use CDC::SetTextColor to set the text color?
I am not good at programing, please say it somewhat detailedly.
Thanks a lot!
|
|
|
|
|
olinn wrote:
Do you mean I should create a new class, inheriting from the orignal control class, for my control which I want to color its text. Then overridde the OnCtlColor function of the class, use CDC::SetTextColor to set the text color?
Yes, that would work.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
I want to get my curent mouse position. I can't store is from WM_MOUSEMOVE because that just works for the time the mouse is on certain controll. What would be the best way to do this?
|
|
|
|
|
GetCursorPos() gets the current mouse position in screen coordinates.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
And how to I convert this point to a point on the control it's on? There's a function for this too but i just cant remember it's name...
|
|
|
|
|
ScreenToClient()
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
I have to get system icon like "my computer" in my program, what can I do?hope to get help from you, TIA
|
|
|
|
|
LPITEMIDLIST pidl;
if(FAILED(SHGetSpecialFolderLocation(NULL, CSIDL_DRIVES, &pidl)))
{
}
SHFILEINFO shfi;
if(SHGetFileInfo((LPCTSTR)pidl, 0, &shfi, sizeof(shfi), SHGFI_PIDL | SHGFI_LARGEICON) == 0)
{
}
LPMALLOC lpMalloc;
if(FAILED(SHGetMalloc(&lpMalloc))
{
}
lpMalloc->Free(pidl);
To get the small icon, use SHGFI_SMALLICON instead of SHGFI_LARGEICON.
Hope this helps,
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
With Windows 2000, this function SHGetSpecialFolderLocation is superseded by ShGetFolderLocation. but when I use ShGetFolderLocation, system tells me error as follows:
error C2065: 'SHGetFolderLocation' : undeclared identifier
Error executing cl.exe
would you like to tell me how to deal with this problem? TIA
|
|
|
|
|
#define _WIN32_IE 0x0500 before including shlobj.h
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Dear sir:do you have similar example? why cant I make it although I do as you told me a moment ago? my email:tiplip@msn.com, thanks a lot!
|
|
|
|
|
This is a program that compiles perfectly on my system (VC6, Oct02 SDK, WinXP):
#include "stdafx.h"
#define _WIN32_IE 0x0500
#include <shlobj.h>
int __stdcall WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmdLine, int nCmdShow)
{
LPITEMIDLIST pidl;
SHGetFolderLocation(NULL, CSIDL_DRIVES, NULL, NULL, &pidl);
return 0;
} It doesn't do actually anything useful so you'll need to fill in the rest from the last example I gave you.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
I have been using the getline() to read in lines from a file and delimiting on commas.
I need to set the items in a struct to these values that I read in.
When I get the data from the struct, I get garbage out.
Am I doing this wrong?
Some of the variables that are read in from the file are doubles and I have been using the atof() function to convert from string to double. But, the only way that the struct will allow me to put them in is if I use the c_str() function.
Thanks,
sj
<br />
<br />
<br />
struct TSimSignal<br />
{<br />
double Min[5]; <br />
double Max[5]; <br />
double Value[5]; <br />
string Name[5];<br />
string Unit[5];<br />
};<br />
<br />
<br />
<br />
void setInitialValues(TSimSignal &s){<br />
<br />
string name,unit,min,max,value;<br />
<br />
fin.open("mockData.dat"); <br />
<br />
for(int i=0; i<sizeof(s.Name); i++){<br />
getline(fin, name, ',');<br />
if(name == "STOP")<br />
break;<br />
getline(fin, unit, ',');<br />
getline(fin, min, ',');<br />
getline(fin, max, ',');<br />
getline(fin, value);<br />
<br />
<br />
}<br />
<br />
<br />
}<br />
<br />
|
|
|
|
|
Just a hint. When you're posting code, replace the '<' and '>' with '<' and '>' respectively, otherwise things like your for loop won't turn out properly.
Your code looks correct. Is the data getting loaded correctly? Can you see the values in the strings with debugger before you store it to the struct? Is fin declared as an ifstream ? You might want to post the code with the '<' and '>' changed - it would make it a lot easier to see what it's doing
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Sorry about that, slipped my mind.
After watching the debugger, I realized the problem lies when I read the data back out of the struct.
I was using the sizeof(s.Name) thinking that it would return 5, but it was returning 80.
OK..... The getline returns a string. I really need my struct to have chars instead of strings.
But as you know; you can't convert a sting to a char.
Is there any way to do this?
I've only been coding for a few months now.
Thanks for the patients,
sj
-----------Right now it is......----------
struct TSimSignal<br />
{<br />
double Min[5]; <br />
double Max[5]; <br />
double Value[5]; <br />
string Name[5];<br />
string Unit[5];<br />
};
-----I really need it to be.....----------
struct TSimSignal<br />
{<br />
double Min[5]; <br />
double Max[5]; <br />
double Value[5]; <br />
char Name[5];<br />
char Unit[5];<br />
};<br />
|
|
|
|
|
johnstonsk wrote:
char Name[5];
char Unit[5];
Actually, it should be:
char *Name[5];
char *Unit[5]; since C strings are a pointer to an array of characters. Then do this:
s.Name[i] = strdup(name.c_str());
s.Unit[i] = strdup(unit.c_str()); Hope this helps,
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
|
@Ryan : After using the "show me all" routine :
for(int i=0; i<sizeof(s.Name); i++){
getline(fin, name, ',');
if(name == "STOP")
break;
getline(fin, unit, ',');
getline(fin, min, ',');
getline(fin, max, ',');
getline(fin, value);
~RaGE();
|
|
|
|
|
Perhaps Chris should add a script that automatically converts '<' and '>' in <pre> tags to HTML character codes .
and possibly '&' as well
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|