|
the file is opened for reading in at the very top of the file where i initialize of the variables in th header class. i am assuming that this happens only once... these are the lines:
code:
--------
extern springCore* springApp;<br />
<br />
extern int window_height, window_width;<br />
extern int wf_window_id;<br />
extern void Reshape(int w, int h);<br />
extern SensorArray sensorarray;<br />
extern int current_sensor_index;<br />
<br />
int loop_1, loop_2, loop_3, i = 0;<br />
<br />
int dg_scenario::debug = 0;<br />
int dg_scenario::wf = 1;<br />
int dg_scenario::video = 0;<br />
double len = 5.0;<br />
<br />
extern int left_down, right_down, middle_down;<br />
<br />
ofstream dg_scenario::dg_video("replay.txt", ios::out); <-- for reading INTO the file<br />
ifstream dg_scenario::dg_replay("replay.txt", ios::in); <-- for reading OUT OF the file<br />
char tool_name_1[256];<br />
char tool_name_2[256];<br />
double x,y,z = 0.0;<br />
int d,ts,ss = 0;<br />
Point3D xyz;
--
dg
|
|
|
|
|
OK - i did some playing around and some googling and for some reason if I replace:
dg_replay.getline(tool_name_2,256);
with:
dg_replay >> tool_name_2;
the numbers are read in successfully..
weird..i feel lucky!
--
dg
|
|
|
|
|
Cool
Mark Salsbery
Microsoft MVP - Visual C++
This episode brought to you by the number 3
|
|
|
|
|
I'm sorry for this re-post. I invested much time in my design and need to get it working.
I've got a Wizard Form where i create controls in runtime.
I need to attach the reference/pointer of a String/double variable to a control. This variables exists in another class. so when the Wizard finishes, i iterate through all the controls and each control updates it's own referenced varaible. In .NET i used the Control.Tag property (is of type Object - that was easy). Want to do the same in C++ but the Control->Tag is of int type.
Im missing something. Help me to convert the parameter Value:
<br />
void ExcuteWizard(..., AnsiString &Value)<br />
{<br />
TTextbox ctrl = new ....;<br />
<br />
ctrl->Tag = Value;
<br />
}<br />
void FinnishWizard()<br />
{<br />
for each control{<br />
((&AnsiString)Control->Tag) = Control->Text;
}<br />
}<br />
<br />
Have someone a theory or explanation with regards to pointer and reference conversions? From a Pointer to a Int back to the Pointer. Hope you guys understand what i'm trying to do.
Thanks.
|
|
|
|
|
I need a simple Windows application to detect messages from a USB drive. When the application detects that a USB device has been inserted, I need to launch another application.
I have found an example which works in .NET environments but I can't guarantee that all my users will be working on .NET-supported platforms.
Does anyone know of a simple C++ application containing a basic message loop that I can adapt? I don't care about the UI.
Alternately, is there an easy way to convert .NET code so that it will work on a non-.NET platform?
I'm working in Visual C++ 2005 Express.
Thanks!
|
|
|
|
|
|
I want to cut a bitmap and save the selection I cut what is anomalistic under GDI+.Is there any program that I can refer to?
Thanks.
|
|
|
|
|
Do you mean something like this?
Gdiplus::Bitmap SrcBitmap(...);
...
Gdiplus::Bitmap DstBitmap(CropWidth, CropHeight, SrcBitmap.GetPixelFormat());
Graphics DstGraphics(&DstBitmap);
DstGraphics.DrawImage(&SrcBitmap, 0, 0, CropLeft, CropTop, CropWidth, CropHeight, UnitPixel);
Mark
Mark Salsbery
Microsoft MVP - Visual C++
This episode brought to you by the number 3
|
|
|
|
|
I am not so familiar with GDI+,so I don't know that the code your provided can wheather achieve my purpose definitely.What I mean is the region in the bitmap is not necessarily a rect,it is mainly region that I draw with mouse.So it is a irregular region.Could you get it?;P
|
|
|
|
|
Chen-XuNuo wrote: What I mean is the region in the bitmap is not necessarily a rect,it is mainly region that I draw with mouse.
You could create a GraphicsPath object from the mouse points defining the outline and then
use Graphics::SetClip() to set the clipping region to the GraphicsPath in the destination
Graphics object before drawing the bitmap.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
This episode brought to you by the number 3
|
|
|
|
|
I have a dialog-based program,
I want to draw my own title bar,so I completement ON_WM_NCPAINT() message of the dialog.
In the OnNcPaint() funtion,I wrote:
CDC* pDC=GetWindowDC();
CDC memDC;
BOOL ret=memDC.CreateCompatibleDC(pDC);
int nSaveDC=pDC->SaveDC();
CBitmap bmp;
ret=bmp.LoadBitmap(IDB_LOGIN);//IDB_LOGIN is a bitmap resource ID
memDC.SelectObject(&bmp);
CRect rc;
GetWindowRect(&rc);
ScreenToClient(&rc);
ret=pDC->BitBlt(0,0,rc.Width(),m_captionRect.Height(),&memDC,0,0,SRCCOPY);
bmp.DeleteObject();
ReleaseDC(&memDC);
pDC->RestoreDC(nSaveDC);
the code works well when the dialog was shown first time,but when the dialog should be redrawn,the title bar went back to its default look(the blue bar).
Someone would like to tell me why?And how to resolve it?
Thanks.
GOOD LUCK.
|
|
|
|
|
i am not sure but it sounds like you need to send an update to your non-client area
Yours Truly, The One and Only!
|
|
|
|
|
Thanks.
Now,it works well.But if you would like to tell me how to make the client area's left-bottom and right bottom is round conor?
|
|
|
|
|
i'm afraid i have not done GDI and custom drawing in a sometime these days most of my development is focued on non-gui core development!
i am sure you should be able to find custom driawing how-to on this site understand mfc section, have you tryed that?
Yours Truly, The One and Only!
|
|
|
|
|
Thanks,but I has searched in this site faild.
GOOD LUCK.
|
|
|
|
|
ok here's how to do it if you're resourceful.
the first time around before you window come up you will have to grab the background and draw it into a z-buffer(off-screen buffer), only grab the rectangle area of the bottom portion you will need the round corned, follow me, then you do your non-client magic drawing in the bottom portion of your window!
that is the first step, the 2nd step once you get this working it to make it be able to grab area while your window is getting move around...remember to paint back the original screen background if that is required, most likely you will not have to worry about this last part.
hope that helps! remember just use the window DC and you will need to covert the between screen point and client point!
hope that help....learn to do this for yourself, you will be a better developer for it
Yours Truly, The One and Only!
|
|
|
|
|
I'm trying to convert and short int into 2 bytes to be send through an ethernet comm. This is what I'm trying to do:
char calcsendbuf[3];
short int data;
printf("Please Enter The Data:");
scanf("%d", &data);
calcsendbuf[0] = char(data % 256);
calcsendbuf[1] = char(floor(double(data/256)));
printf("byte 0: %u\n", calcsendbuf[0]);
printf("byte 1: %u\n", calcsendbuf[1]);
I input 32767 as the data and it should be printing 255 and 127, but I'm getting 4294967295 and 127. Any ideas of what is going wrong here, or maybe a different way of doing things?
Thanks
|
|
|
|
|
simoncoul wrote: I input 32767 as the data and it should be printing 255...
Since a char has a range of -128 to 127, trying to assign it a value of 255 will not do what you want.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
You will never get 255 with a signed char, since chars are only 1 byte (your range is 2^7 both ways). Use the unsigned char instead.
|
|
|
|
|
Ok using the unsigned char worked for the display but the send function in winsocks asks for a char *, how do I go about getting sending a single byte of 255 through ethernet using winsocks.
|
|
|
|
|
To be honest, I have no clue. I won't pretend that I know anything about winsocks, but IF (and that's a big if) all it has to do is with type conversion, you can simply cast it on the send, and cast it back when you receive it.
|
|
|
|
|
Thanks for the help I took my unsigned char array and cast it as char * in the send function and it all works now.
Thanks for all the help!!!
|
|
|
|
|
Hi guy this is so lame i cant pass parameters between classes, i feel like commiting sucide (
anyways
I have used a public variable in say class A
Public:
long iSelPackageItemID;
and assigned the value in function...
setPackageID()
{
iSelPackageItemID=some value;
}
then i have declared a function
long getPackageID()
(
return iSelPackageItemID;
)
after a long long time i call the function getPackageID()
from some another class say B and i am getting garbage value i.e. getPackageID() is returning garbage.
Whatever is the solution i just want the value from iSelPackageItemID in class B which is assigned in class a.
|
|
|
|
|
Maybe you have casting problem. post the code when you call setPackageID from your B class (before taking any action for suicide )
|
|
|
|
|
No casting since all the variables are long. I checked in the debug mode that the value is retained in the class as along the variable is in scope, but garbage value is assigned once the value goes beyond the scope. I guess i need to increase the scope of variable to application variable.. How do i do it...?
|
|
|
|