|
o!! I find the problem at last! It is a Multithread problem, one data struction used in multithread without protection, data was dirty. 
|
|
|
|
|
a dirty DWORD???
you mean you didn't correctly make a local copy then, it is too small to not update atomically.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
my multithread app used some threads which have a socket parameter sent in,before the parameter being used ,another thread make it dirty. this is what happened in my app.
|
|
|
|
|
Is there any way to save these files programmaticaly
Trioum
modified on Friday, June 12, 2009 2:04 AM
|
|
|
|
|
trioum wrote: We Normally save the existing file (.doc,.txt etc) by pressing the save button
What save button? In which application? Who is "We" and could you elaborate on "Normally"?
trioum wrote: Is there any way to save these files programmaticaly
Possibly. That's the best I can do with the given context.
|
|
|
|
|
ok process from another programme
Trioum
modified on Friday, June 12, 2009 2:10 AM
|
|
|
|
|
trioum wrote: by pressing the save button
OK, I just spotted the thread where you asked the same question:
http://www.codeproject.com/Messages/3053288/saving-file.aspx[^]
The save button you refer to appears to be some mystical entity or is possibly located in a parallel universe (or both?) since you are unable to tell us more about it.
|
|
|
|
|
tell me one thing what will you do if save the content
Trioum
modified on Friday, June 12, 2009 2:16 AM
|
|
|
|
|
|
I think what he's looking for is a way to send the correct message or key value to another program to make it save the current file, something which has been covered here many times, and which Google will give an answer to in about 5 ms.
There are three kinds of people in the world - those who can count and those who can't...
|
|
|
|
|
Why the hell are you posting all this rubbish in the Visual C++ forum? Can't you just see what kind of lame posts are you making?!
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Word provides a menu item for this or am I wrong?
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
The level of dross questions have increased many fold these days.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Must be a nest somewhere nearby...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
I implemented an open file dialog based on the following sample:
Host Windows Explorer in your applications using the new Vista hosting APIs[^]
It displays a fully functional Windows Explorer window to allow the user to navigate and pick a file or folder.
Everything works fine except one detail. When the user double clicks a file in that window, the system attempts to open it with the default application registered for that type of file. I don't want that, because I want my application to open the file.
More precisely, my application searches for resources in executables. When the user double clicks an exe file, I don't want the file to be started to run, I just want to search it.
I need to intercept the double click messages, but I'm clueless how to do that using ATL.
Using the CFileDialog class is not an option, I need to select directories too.
Using SHBrowseForFolder is not an option either, I need additional controls in the dialog.
|
|
|
|
|
Hello, can anyone please point me in the right direction on how to print from a dialog based application?
I have scoured the net for countless hours searching for a solution to this problem.
I know it's a standard task in an SDI or MDI application but I already have a nice dialog based application created and I don't want to start over or convert it to SDI/MDI.
Specifically what I want to do is print a CTreeCtrl out. But basically I'm wondering is there is a general strategy for printing out the contents in any control, whether it be a picture control with a bitmap, list control in report view, or whatever it may be. If I can just get a concrete example of how to print out some control, a tree one for example, then I think I can figure out to print other controls.
No one out there seems to know how to do this. I've found code examples in several places that supposedly lets you print a bitmap, but I'm not sure how to "convert" a control to a bitmap...besides, that sounds like overkill.
What few references I have found involve very convoluded code that involves getting a printer DC and then attaching it some other member variable (the examples never tell you exactly what type object the m_x variable is that they attach the printer DC to), then some other stuff is done and eventually startPage(), etc. are called. But I have never been able to get any of these examples to compile, even after tinkering with them for hours.
So is there anyone out there reading this that can please help me with this?? I'm not asking for anyone to write the code for me. All I need is a clear explanation of the procedure for printing out a control.
Please help!?
|
|
|
|
|
Printing on Windows it is much ike drawing, i.e. you get a print DC and the use it to render graphical output to the printer. As introductory material see, for instance, this article [^].
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Here is an article for printing without the Document/View framework: [^]
And here is a an article for printing the content of CTreeCtrl: [^]
Nuri
|
|
|
|
|
i wana help in generating the dice in C language
numbers are generating eandomly but the problem is with image
actually i m making a game of ludo
the code is as follows
it is excuteable code
plzzzz any one can help
#include<<stdio.h>>
#include<<conio.h>>
#include<<iostream.h>>
#include<<graphics.h>>
#include<<math.h>>
#include<<stdlib.h>>
#include<<process.h>>
#include<<dos.h>>
#include<<string.h>>
#include<<malloc.h>>
int mx,my,d,c;
int size;
int dice;
void *dot;
void initgraphics();
void images();
void gen_dice();
int get_dice();
void image1();
void play();
void put_rect();
void images()
{
cleardevice();
//BOUNDARY
setcolor(13);
rectangle(0,0,450,475);
//HOMES
setcolor(14);
circle(90,100,70);
setcolor(4);
circle(360,100,70);
setcolor(2);
circle(90,380,70);
setcolor(1);
circle(360,380,70);
//STAY POINTS FOR YELLOW HOME
setcolor(14);
circle(75,277,10);
circle(75,250,10);
circle(45,250,10);
circle(105,250,10);
circle(135,250,10);
circle(165,250,10);
circle(45,223,10);
//STAY POINTS FOR BLUE HOME
setcolor(1);
circle(285,250,10);
circle(315,250,10);
circle(345,250,10);
circle(375,250,10);
circle(405,250,10);
circle(405,277,10);
circle(375,222,10);
//STAY POINTS FOR GREEN HOME
setcolor(4);
circle(225,50,10);
circle(225,85,10);
circle(225,120,10);
circle(225,155,10);
circle(225,190,10);
circle(255,50,10);
circle(195,85,10);
//STAY POINTS FOR GREEN HOME
setcolor(2);
circle(225,305,10);
circle(225,335,10);
circle(225,365,10);
circle(225,395,10);
circle(225,425,10);
circle(195,425,10);
circle(255,395,10);
//vertical lines for upper path
setcolor(3);
line(180, 0, 180, 210);
line(210,0,210,210);
line(240,0,240,210);
line(270,0,270,210);
//horizontal lines for upper path
line(180,0,270,0);
line(180,35,270,35);
line(180,70,270,70);
line(180,105,270,105);
line(180,140,270,140);
line(180,175,270,175);
line(180,210,270,210);
//vertical lines for lower path
line(180,290,180,475);
line(210,290,210,475);
line(240,290,240,475);
line(270,290,270,475);
//horizontal lines for lower path
line(180,290,270,290);
line(180,320,270,320);
line(180,350,270,350);
line(180,380,270,380);
line(180,410,270,410);
line(180,445,270,445);
line(180,476,270,476);
//vertical lines for left path
line(0,210,0,290);
line(30,210,30,290);
line(60,210,60,290);
line(90,210,90,290);
line(120,210,120,290);
line(150,210,150,290);
line(180,210,180,290);
//horizontal lines for left path
line(0,210,180,210);
line(0,235,180,235);
line(0,265,180,265);
line(0,290,180,290);
//vertical paths for right path
line(270,210,270,290);
line(300,210,300,290);
line(330,210,330,290);
line(360,210,360,290);
line(390,210,390,290);
line(420,210,420,290);
line(450,210,450,290);
//horizontal lines for right paths
line(270,210,450,210);
line(270,235,450,235);
line(270,265,450,265);
line(270,290,450,290);
settextstyle(SANS_SERIF_FONT,0,3);
setcolor(19);
outtextxy(200,235,"LUDO");
getch();
}
void gen_dice()
{
switch (get_dice())
{
case 1: //dice output is 1
put_rect();
putimage(535, 165, dot, COPY_PUT);
put_rect();
break;
case 2: //dice output is 2
put_rect();
putimage(515, 145, dot, COPY_PUT);
putimage(555, 185, dot, COPY_PUT);
put_rect();
break;
case 3: //dice output is 3
put_rect();
putimage(515, 145, dot, COPY_PUT);
putimage(535, 165, dot, COPY_PUT);
putimage(555, 185, dot, COPY_PUT);
put_rect();
break;
case 4: //dice output is 4
put_rect();
putimage(515, 145, dot, COPY_PUT);
putimage(555, 145, dot, COPY_PUT);
putimage(515, 185, dot, COPY_PUT);
putimage(555, 185, dot, COPY_PUT);
put_rect();
break;
case 5: //dice output is 5
put_rect();
putimage(515, 145, dot, COPY_PUT);
putimage(555, 145, dot, COPY_PUT);
putimage(535, 165, dot, COPY_PUT);
putimage(515, 185, dot, COPY_PUT);
putimage(555, 185, dot, COPY_PUT);
put_rect();
break;
case 6: //dice output is 6
put_rect();
putimage(515, 145, dot, COPY_PUT);
putimage(515, 165, dot, COPY_PUT);
putimage(515, 185, dot, COPY_PUT);
putimage(555, 145, dot, COPY_PUT);
putimage(555, 165, dot, COPY_PUT);
putimage(555, 185, dot, COPY_PUT);
put_rect();
break;
}
}
int get_dice()
{
dice=random(6);
if(dice==0)
{
dice++;
}
return (dice);
}
void image1()
{
setcolor(0);
setfillstyle(1, 0);
rectangle(535, 165, 545, 175);
floodfill(540, 170, 0);
size=imagesize(535, 165, 545, 175);
dot=malloc(size);
getimage(535, 165, 545, 175, dot);
//cleardevice();
images();
play();
}
void play()
{
int ch;
again:
ch=getche();
if(ch==13)
{
gen_dice();
goto again;
}
else if(ch==27)
{
exit(0);
}
}
void main(void)
{
clrscr();
initgraphics();
image1();
getch();
}
void put_rect()
{
setcolor(WHITE);
setfillstyle(SOLID_FILL, 15);
rectangle(500, 130, 580, 210);
floodfill(510, 140, 15);
}
|
|
|
|
|
So...Waht is your question?
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
how the proper image of the dice can be generated properly??
one image is not replaced by the other image
|
|
|
|
|
Why didn't you report also the initgraphics function (you provided only the prototype)?
Is the compiler happy with two implementations of the same function (gen_dice ) that differ just for the return value type?
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
hey man
just see the code carefully
and tell either u can solve the problem or not
i just got problem in generating the dice of image
so kindly tell me either u can do any thing r not
|
|
|
|
|
swtlibra wrote: hey man
just see the code carefully
Hey man I've seen again your code and the initgraphics function definition is still missing.
swtlibra wrote: and tell either u can solve the problem or not
Yes, I can. However, when the request is nice like yours, my rate is 150 euro/hour: can you kindly tell me if you're going to pay such a rate?
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
The weirdest thing :
compiling the following C code with gcc (no options) on linux64 :
int main ()<br />
{<br />
unsigned int i,j ;<br />
printf("start");<br />
for (i=j=0;i < UINT_MAX ;i++);<br />
printf("end");<br />
}<br />
<br />
produces a faster binary than this next (leaner) code :
int main ()<br />
{<br />
unsigned int i ;<br />
printf("start");<br />
for (i=0;i < UINT_MAX ;i++);<br />
printf("end");<br />
}
Can someone explain ??
The first code takes around 13-14 seconds on average to run on my machine (dual core AMD64)
the second code takes 14-15 seconds ,on average between 1-2 seconds slower
why would the addition of an extra int (namely j) produce faster code ?
Can you reproduce on your machine ? 
|
|
|
|
|