|
|
hi,
Take a look the structure of my array first:
struct WAITQUEUE_STRUCT
{
CWinThread* pThread;
int LockType;
LARGE_INTEGER start_time;
};
struct LOCK_TABLE
{
CWinThread* CurrentThread;
int CurrentLock;
std::vector<WAITQUEUE_STRUCT> WaitQueue;
};
std::vector<LOCK_TABLE> LockTable;
In my program:
std::vector <WAITQUEUE_STRUCT>::iterator Iter;
for (int i=0; i<NumOfDBObject; i++)
{
Iter = LockTable[i].WaitQueue.begin();
if (*Iter.pThread != NULL) <- one of the error here
{ .......
.......
.......
i got the error message :
"error C2228: left of '.pThread' must have class/struct/union type"
What happened??????
|
|
|
|
|
ChiYung wrote:
for (int i=0; i{
Iter = LockTable[i].WaitQueue.begin();
if (*Iter.pThread != NULL) <- one of the error here
{ .......
(*iter).pThread
or
iter->pThread
|
|
|
|
|
DEar Friends
I always refer Charles Petzold book fo basic programming code. So I want to get a complete .dsw file. Kindly give/send me any such zip file which reads a bitmap file and then display it after getting hdc. I am working on Win32API only.
Thanking you in advance.
Binay
|
|
|
|
|
after you use LoadImage to load the bitmap, use this code in your window procedure to draw it:
case WM_PAINT:
{
hdc = BeginPaint(hWnd, &ps);
RECT rt;
GetClientRect(hWnd, &rt);
HDC DC = CreateCompatibleDC(hdc);
HBITMAP oldBitmap = (HBITMAP)SelectObject(DC, hBitmap);
BitBlt(hdc, 0, 0, rt.right, rt.bottom, DC, 0, 0, SRCCOPY);
SelectObject(DC, oldBitmap);
DeleteDC(DC);
EndPaint(hWnd, &ps);
}
HTH
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
It may be that your sole purpose in life is simply to serve as a warning to others.
|
|
|
|
|
If I did that, I would be doing your homework for you. It should be very easy to figure out with the code I have given you. If you have any more specific questions, ask the in this forum, there are lots of people who will help you.
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
It may be that your sole purpose in life is simply to serve as a warning to others.
|
|
|
|
|
Hi,
I would like to terminate the FOR loop at the middle of the loop. E.g.
for (i=0; i<100; i++)
{
if (i == 50)
break;
}
Is it use break???? Or.........
Thanks!!!!
|
|
|
|
|
Yes.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
Hi,
Is there a function to set a timer?? In my case, I want to keep track of the time that a thread is being suspended, so that it would be suspended forever.
Or, can you give me any suggestion to do that??
Thank you!
|
|
|
|
|
You can use SetTimer and then in the handler do your custom time tracking.
Nish
I am looking for a free racing game. Old style racing game without any complicated 3D stuff. Around 4 MB download. If anyone has such a game, please inform me.
|
|
|
|
|
Thank you so much for your reply..!
But, I still have problem with SetTimer(). I always got error messages like "function does not take 1 (or 2) parameters". Can you please give me an example of using SetTimer?? For example: what I can do if I want to count in 5 sec??
Thank you !
|
|
|
|
|
SetTimer(1000,5000,NULL);
1000 is the ID of this particular timer
5000 means 5 seconds
NULL means the WM_TIMER handler of the CWnd object gets called
Nish
I am looking for a free racing game. Old style racing game without any complicated 3D stuff. Around 4 MB download. If anyone has such a game, please inform me.
|
|
|
|
|
Thank you very much!
|
|
|
|
|
If you want to keep track of the time, you better use GetTickCount()
Michel
If I am wrong or said something stupid, I apologize in advance
|
|
|
|
|
As long as you watch out for overflow in the count.
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
I have a C++ program that has some context information for an HTML page. How can I pass parameters to an HTML page?
Thanks,
Hawk
|
|
|
|
|
I'm not entirely sure what you mean about context information and what HTML page you're talking about.
If you've got a HTML control and you're using Navigate() to open a page, you just need to append the CGI parameters to your target path. For example for the page:
http:
you can just append parameters to set the variable 'Name' to 'Joe Blow' and 'Age' to 25 as follows:
http:
You need to replace ' 's with '+'s. Also, technically, you need to replace any unprintable characters with escape sequences '%2F'. To find out more, search MSDN for CGI and ISAPI information.
Hope this helps.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
Derek,
Thanks for that input. I have just started tinkering with ASP but I think that would require a server right?
Here is the scoop. I have a MFC C++ application that uses the WebBrowser2 interface. I am navigating to an HTML file that looks like this:
<xml id="data" src="CurrentStates.xml">
<xml id="format" src="TransformCurrentState.xsl">
CurrentState.innerHTML = data.transformNode(format.XMLDocument);
The "TransformCurrentState.xsl" needs to parse through the "CurrentStates.xml" which is a database of several dozen elements. The user can identify which element to be parsed but I don't have any way to tell the script which element is to be parsed.
Ideally there would be a way to tell this script something like: building=1 floor=1 room=1. Right now I am doing some pretty ugly stuff. I am generating a small xsl file that is included by the "TransformCurrentState.xsl". It works but it feels wrong so I know there must be a better way.
Any more thoughts?
Thanks,
Steve
|
|
|
|
|
That doesn't look to good.
Here is the file again:
.
.
.<xml id="data" src="d:/NOWTrak/database/system/CurrentProbeStates.xml">
.<xml id="format" src="TransformCurrentState.xsl">
.
. CurrentState.innerHTML = data.transformNode(format.XMLDocument);
.
.
.
.
.
.
|
|
|
|
|
For Pete's sake!
<.HTML>
<.HEAD>
<.XML id="data" src="d:/NOWTrak/database/system/CurrentProbeStates.xml">
<.XML id="format" src="TransformCurrentState.xsl">
<.SCRIPT FOR="window" EVENT="onload">
CurrentState.innerHTML = data.transformNode(format.XMLDocument);
<./SCRIPT>
<.BODY TOPMARGIN=0 LEFTMARGIN=0 BGPROPERTIES="FIXED" BACKGROUND="ATMINOWTRAK.JPG">
<.DIV id="CurrentState" style="position:absolute;left=200;top=10;font-family:'Arial';font-size:12;font-weight:bold">
<./DIV>
<./BODY>
<./HTML>
|
|
|
|
|
Oooh, XML. Sorry, can't help you with that, I'm afraid. I know that if you were using ASP (VBScript here, I'm afraid), and you tried to open:
http://www.myserver.com/scripts/hello.asp?Name=Joe+Blow
and hello.asp contained:
<%
vstrName = Request.QueryString("Name")
%>
then vstrName would contain "Joe Blow". As for how you use that in your XML, I'm not sure.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
I am converting a lot of old projects' resources into separate resource DLLs so that we can easily localize the resource dll to different languages. For MFC application, it is easy since I only have to call "AfxSetResourceHandle" at the program's initialization. But, for a traditional C windows program, it seems there is NO such easy thing. For each LoadString or LoadIcon... in the original c program, I need to manually put the resource dll's handle there. Is there any other better way to handle this. Thank you very much.
|
|
|
|
|
HINSTANCE g_hCurrentResource;
HINSTANCE MySetResourceHandle ( HINSTANCE h ) {
HINSTANCE prev = g_hCurrentResource;
g_hCurrentResource = h;
return ( prev );
}
int MyLoadString (
UINT uID,
LPTSTR lpBuffer,
int nBufferMax ) {
return ( LoadString ( g_hCurrentResource, uID, lpBuffer, nBufferMax ) ); }
cheers,
-Ben
|
|
|
|
|
Can someone please explain how i can change the color of the background of a text box and change the color of the text itself?
Thanks
|
|
|
|
|
Text Box? Did you mean CEdit control?
I think maybe you can change the font color to change the color of
the text.
|
|
|
|