|
Just one point (in case Imran is confused)
In Chris L's "set" example, a is the MSByte and d is the LSByte
In his "get" example, he's kinda reversed it so that :-
a is the LSByte and d is the MSByte
Thought I'd mention it here.
Regards,
Nish
Author of the romantic comedy
Summer Love and Some more Cricket [New Win]
Review by Shog9
Click here for review[NW]
|
|
|
|
|
Don't you like the MAKELONG and MAKEWORD macros?
|
|
|
|
|
u can use this structur & union to do it
union {
DWORD a;
struct {
_1:1;
_2:1;
_3:1;
_4:1;
_5:1;
_6:1;
_7:1;
_8:1;
_9:1;
_10:1;
_11:1;
_12:1;
_13:1;
_14:1;
_15:1;
_16:1;
}bits;
}DW;
you can use that struct
to set a bit first palce your DWORD var to "DW.a" then set bits:
DW.a = YourVar;
DW.bits._1 = 1;//set the first bit to one
DW.bits._2 = 0;//set th second bit to zero
.
.
.
YourVar = DW.a;
Iman Ghasrfakhri
|
|
|
|
|
|
When I compile my program I keep getting errors that some symbols are multiply defined. The items in question are in a global hearder file that each class needs to include so I assume this is where the problem exists, in that the file is being included into every class and producing the errors. I tried putting include guards on the header file but it doesn't change anything. Any help in this matter would be much appreciated.
Thanks in advance.
- Monrobot13
|
|
|
|
|
In the file that every other file includes, I assume you have something like:
var_type iSomeGlobVar;
Replace it with:
extern var_type iSomeGlobVar;
then, in some .cpp file (the one that goes with the .h one, if possible):
var_type iSomeGlobVar;
That should fix it.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
Thanks Michel, just one quick question, will this same procedure work for functions and structs?
Monrobot13
|
|
|
|
|
A struct can be defined in a .h that is included multiple times with no problem. But if you have a variablee of some struct type, use the export keyword. Same with functions.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
Can any body tell how to get the mouse position from the LPARAM.
lParam has WM_LBUTTONUP message.
LPARAM lParam;
LPEVENTMSG lpEvent= (LPEVENTMSG)lParam;
//lpEvent->paramH;
//lpEvent->paramL;
i think i can get mouse position using lpEvent pointer but i could not successed yet
can any body tell how to get it.
r00d0034@yahoo.com
|
|
|
|
|
<br />
xPos = GET_X_LPARAM(lParam); <br />
yPos = GET_Y_LPARAM(lParam); <br />
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Hello all. I have searched through all the Tree Controls on code project and I have yet to find what I need. It could be that I am not looking hard enough, or that I am just blind , but your help would be appreciated.
Anyway, I am looking for a tree control that uses check boxes and is smart enough to check all the parent nodes (in that greyed check sort of way) when a child node is checked. I have seen it in just about every application, and I have yet to find anything here.
Thanks in advance.
***********************
Tony Fontenot
Recreational Solutions
tony@recsolutions.com
***********************
|
|
|
|
|
Hello,
I am changing my server to support multithreading. However, I have problem. This is how the server main loop is
<br />
<br />
CSocket clientS;<br />
<br />
while (run)<br />
{<br />
Print_Log("A loop... : mainServer->Start()");<br />
cs.Accept(clientS);<br />
hSThread = CreateThread(NULL, 0, ServiceThread, &clientS, 0, &threadId);<br />
}
<br />
<br />
Here is my thread call back function:
<br />
DWORD WINAPI ServiceThread(LPVOID p)<br />
{<br />
CSocket* clientS = ((CSocket*)p);<br />
int re;<br />
char r[6];<br />
<br />
do<br />
{<br />
re = clientS->Receive(r, 6);<br />
if (re != 0)<br />
cout << r << endl;<br />
} while (re != 0);<br />
clientS->Close();<br />
return 0;<br />
}
<br />
I get a error message when the client send me somehing, which is "Debug Assertion Fail". The server can actually receive the message, but when the thread is going to close. The error message come out. I didn't know where my code have make the mistake. Can anyone help me? Thanks!
Nachi
|
|
|
|
|
I have a tab control in a single document VC++ document. I have individual dialogs for each tab in the control and the main dialog (CNewStats) also has a Load Stats button. Is there any way to update the data in the dialogs that are inside the tab control after the Load Stats function has been executed? Any help is appreciated.
Brad Jennings
|
|
|
|
|
Nevermind all. I figured it out. Thanks, though, if you took a look at it. Later.
Brad Jennings
|
|
|
|
|
I am developing an app that will, amongst other things, act as an OLE client. My app will currently embed and display an object, such as a Word document, but I want to go one step farther. When the Word object is displayed it only shows the first page... I want to give the user the ability to scroll through all of the pages (without actually editing the object). I tried deriving my view class from CScrollView, but this only gives the ability to scroll the first page of the Word doc up and down...It doesn't show the rest of the pages.
Does anyone know how to scroll the embedded client object (code examples would help alot)?
Gary Kirkham
A working Program is one that has only unobserved bugs
|
|
|
|
|
I have in the VC client a progressbar on the UI.:
BSTR bstrDesc;
try
{
CoInitialize(NULL);
_Class1Ptr ptr;
ptr.CreateInstance(__uuidof(Class1));
m_Progress1.SetStep(1);
m_Progress1.SetRange(0, 10);
long lHwnd=(long)m_Progress1.GetSafeHwnd();
ptr->CheckingStuff(&lHwnd);
}
and the VB dll function is:
For i = 1 To 10
result = SendMessage(PbarHandle, PBM_STEPIT, 0, 0)
Next
PBM_STEPIT = 1029
The progressbar in the VC UI remains stubbornly blank. What am I missing? Some manual setting for the progressbar, or some programmatic setting? How can I check if SendMessage is working?
Thanks,
ns
|
|
|
|
|
Things to check:- Make sure the whole
HWND -passing mechanism is OK by having the VB function output the value of the handle passed and verifying that it is the same as the one you have in your MFC app.
- Try posting messages instead of sending them.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Did Postmessage. Handle passe din is correctly received. Catching a com error in try catch. 0x0014509c - thats whats in the e.description.
Also:
First-chance exception in msway.exe (KERNEL32.DLL): 0xC000008F: Float Inexact Result.
First-chance exception in msway.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.
Does this mean anything?
}
catch(_com_error &e)
{
bstrDesc = e.Description();
}
Thanks,
ns
|
|
|
|
|
Interesting ly the msgbox doesnt fire:
result = PostMessage(PbarHandle, PBM_STEPIT, 0, 0)
MsgBox result
Thanks,
ns
|
|
|
|
|
The VC client calls the VB dll:
{
CoInitialize(NULL);
_Class1Ptr ptr;
ptr.CreateInstance(__uuidof(Class1));
m_Progress1.SetStep(1);
m_Progress1.SetRange(0, 10);
ptr->CheckingStuff(m_Progress1.GetSafeHwnd());
}
in VB there is:
Public Function CheckingStuff(PbarHandle As Long)
The VC compiler grumbles:
error C2664: 'CheckingStuff' : cannot convert parameter 1 from 'struct HWND__ *' to 'long *'
I was told that long in VB should be the type, but apparently not.
I even tried:m_Progress1.GetSafeHwnd()->m_hWnd; and m_Progress1.m_hWnd as the calling function argumnents but thats not right either....
Please help!
Thanks,
ns
|
|
|
|
|
This most likely has to do with the annoying STRICT macro. You can ignore it and simply force the expected type:
long lHwnd=(long)m_Progress1.GetSafeHwnd();
ptr->CheckingStuff(&lHwnd); Good luck.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks, compiles now.
Thanks,
ns
|
|
|
|
|
Hi.
I experience a weird Visual Studio .NET problem and possible bug. I have been using this Visual C++ .NET compiler for a while now, but this problem has never occured. For some reason, Visual C++ wants to rebuild all modules (cpp) whenever I want to run the problem in either debug or release mode. For example, after you run build the problem and run it, you can run it without rebuilding everything if no changes were made. However, now Visual C++ .NET tells me that the programs is out of date everytime I run the program in either debug or release mode. This is true even if I have no changes whatsoever.
Does anyone know a possible reason for this problem?
Thanks,
Kuphryn
|
|
|
|
|
Check the date of all your files inside the project. If some, for some strange reason, is assigned a date in the future this kind of behavior can result.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Okay. You're right. For some reason the clock on my system is off by eight months!
I reset the date and clock. Everything works now.
Kuphryn
|
|
|
|