|
I am trying to create a pointer to a struct, but I keep getting errors.
I have been converting a *.c file to c++ and I am not too familuar with C.
I need to know the size of each one so I know what offset in memory to access the data.
i.e. if the header is 16 bytes long then I know anything larger than 16 bytes is the data values that I need.
I want to be able to access
SimSignal->Min[i];
SimSignal->Max[i];
SimSignal->Value[i];
SimSignal->Name[i];
SimSignal->Unit[i];
All of this data is related to one another.
I hope this makes sense.
Thanks for the help,
Steven
<br />
#define SIMHEAD_ADR 0x40 //This is the hardcoded address of the SimHeader (only hard coded address to RFM)<br />
<br />
<br />
struct TSimHeader<br />
{<br />
int SimWriteFlag; <br />
int DisplayReadFlag; <br />
int SignalCount; <br />
int SimStatus;<br />
};<br />
<br />
<br />
struct TSimSignal<br />
{<br />
double Min[88];
double Max[88];
double Value[88];
char Name[88];
char Unit[88];
};<br />
<br />
<br />
<br />
<br />
TSimHeader* SimHeader= SIMHEAD_ADR;<br />
TSimSignal* SimSignal= SimHeader+sizeof(TSimHeader);<br />
<br />
<br />
d:\.....h(42) : error C2258: illegal pure syntax, must be '= 0'
d:\.....h(42) : error C2252: 'SimHeader' : pure specifier can only be specified for functions
d:\.....h(43) : error C2065: 'SimHeader' : undeclared identifier
|
|
|
|
|
You left off a } somewhere. The compiler thinks it's still in a struct definition when it sees SimHeader = SIMHEAD_ADR and thinks you're declaring a pure-virtual function.
--Mike--
"So where does that leave us? Well, it leaves us right back where we started, only more confused than before." -- Matt Gullett
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
|
|
|
|
|
Actually, you need to prefix the type specifier with the keyword struct.
ex:
struct TSimHeader* SimHeader= SIMHEAD_ADR;
struct TSimSignal* SimSignal= SimHeader+sizeof(TSimHeader);
onwards and upwards...
|
|
|
|
|
Michael Dunn is probubly right about the error messages you received.
But you seem to have a few other problems:
TSimHeader* SimHeader= (TSimHeader*)SIMHEAD_ADR;
TSimSignal* SimSignal= (TSimSignal*)(SimHeader+1);
// This last is equivalent to
TSimSignal* SimSignal= (TSimSignal*)((char*)SimHeader+sizeof(TSimHeader));
//or
TSimSignal* SimSignal= (TSimSignal*)(SimHeader[1]); // Bad, but should work
Trust in the code Luke. Yea right!
|
|
|
|
|
Does anyone know how to install the resource editor. It does not show up in the Add-in manager. It has a batch file and when I click it it seems to install, but I can't use that editor.
|
|
|
|
|
I get the following errors when I declare this struct.
<br />
struct SimSignal<br />
{<br />
double Min;
double Max;
double Value;
char[88] Name;
char[16] Unit;
};<br />
<br />
d:\........h(17) : error C2059: syntax error : '['
d:\........h(17) : error C2238: unexpected token(s) preceding ';'
Looks right to me.
Any Ideas?
Thanks,
Steven
|
|
|
|
|
|
thanks,
I have been converting a *.c file to c++.
steven
|
|
|
|
|
I`m sorry but is the same in c and c++;););)
|
|
|
|
|
Hi,
I got a question with MFC. I have a Dialog and a Scroll bar. A child window (of the dialog) is created and is a lot bigger than the dialog. I want to scroll the window. Srolling work fine, but it's not smooth, a bifg rectangle at the bottom or the top (depending if you scroll down or up) is redrawing the window (like an InvalidateRect). Check out the code: (in the mouse whell event):
if (zDelta<0)
{
if (m_nScrollPos < nMaxPos)
{
zDelta = min(max(nMaxPos/20,5),nMaxPos-m_nScrollPos);
m_nRecalibrateMouse += zDelta;
m_nScrollPos += zDelta;
m_pcScrollBar->SetScrollPos(m_nScrollPos,TRUE);
// that when I move the CWnd -->
m_pcMainWindows->SetWindowPos(NULL, 0, -m_nScrollPos, m_pcMainWindows->MyGetm_nWidth(),m_pcMainWindows->MyGetm_nHeigth(),SWP_NOZORDER | SWP_NOACTIVATE);
}
}
else ...
Thank for helping !
Charles
|
|
|
|
|
this is the code i used in eVC++, in the Windows CE API in the WinMain function, from grattan's, [i]pocket pc development in the enterprise.[/i]
SHELLEXECUTEINFO sei;
TCHAR tFile[255];
if (lpCmdLine[0]==0) wsprintf(tFile, TEXT("\\ePowerDiagnostic.vb"));
else
wsprintf(tFile, lpCmdLine);
ZeroMemory(&sei, sizeof(sei));
sei.cbSize = sizeof(sei);
sei.lpFile = tFile;
return ShellExecuteEx(&sei);
return 0;
supposedly, since the eVB application (project1.vb, [i]ePowerDiagnostic.vb in my case[/i])is "associated with the pvbload.exe, the ShellExecuteEx will load the pvbload.exe file with the project1.vb as a parameter ( just as if we were tapping the project1.vb file from the start menu or programs folder.
however, i followed the instruction, imported an icon, and compiled by using the relase suffix and building the project. i copied the lauch app to the device. however, the error msg i keep getting on the pocket pc is
" 'ePowerDiagnostic' is not a valid Pocket PC application "
I'm not sure where I went wrong....
thx.
|
|
|
|
|
If I have two processes with normal priority, and each has a thread running with different priorities like this:
Process 1
|- Thread 1 (High Priority)
Process 2
|- Thread 2 (Normal Priority)
I'm trying to work out whether the high priority on the thread affects only the thread's chances of getting a slice within the context of slices available for the process, or whether it affects the allocation of slices at the same level as process priority.
That's not hugely clear, I know. Given this scenario, will Thread 1 get more time on the processor than Thread 2 (even though the processes have equal priority)?
Any ideas? Thanks.
--
Simon Steele
Programmers Notepad - http://www.pnotepad.org/
|
|
|
|
|
I believe a thread priority is relative to the priority of the process it resides in.
Kuphryn
|
|
|
|
|
The Base Priority of a thread is determined by both the process priority class, and the thread priority. It's just two different mechanisms (one to weight processes in the system, one to weight threads inside one process)
Thread 1 will (almost) always get scheduled first when both are waiting for an event or similar.
The scheduler always schedules the thread of the highest priority that is ready to run. So Thread 1 will starve thread 2, if it doesn't give up processor time or a second CPU is available.
The one exception is: Input goes to Thread 2. When input waits in the queue for a thread, it's priority is temporarily boosted.
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|
(1)I have an array of pixels to be displayed. Does someone know how to do that?
{
....
char* pixelarray = malloc(sizeof(uint32)*width*height);
fill_in_content(pixelarray);
//how to display the pixelarray on the screen now?
}
(2) if I have an linked list data structure to represent the pixel
struct link_list
{
char pixelvalue[4];
link_list* next;
}link_list;
{
...
link_list* head
build_linked_list(head, width*height);
fill_in_content(head, width*height);
//how to display the content in the linked list to screen?
}
|
|
|
|
|
I'm no GDI expert but a pixel has three properties: X coord, Y coord, and RGB value. With these three values, you can render a pixel at a certain location in the desired color.
|
|
|
|
|
Either create it as a bitmap and use bitblt() or, if you really want to paint each pixel... SetPixel().
onwards and upwards...
|
|
|
|
|
SetPixel() will be slow though.
John
|
|
|
|
|
I created a CStatic subclass that handles ON_WM_KEYDOWN and can capture the key presses ok, but when a key is pressed it generates the beeping sound you usually get when a key press isn't being handled. If anyone knows how I can stop this or where I should start looking I'd appreciate it.
(Also if anyone knows how to capture arrowkey events please let me know, none of ON_WM_KEYDOWN, ON_WM_SYSKEYDOWN, or ON_WM_CHAR seem to catch them)
Thanks
|
|
|
|
|
I'd guess that it's the keyboard device driver intercepting the keystroke before passing it on to Windows.
|
|
|
|
|
Hey All,
Just wondering how I'd go about extracting resources from an MFC app i.e. Bitmaps etc.
Regards,
Brian Dela
|
|
|
|
|
Can't you load the EXE in Visual Studio as a file and get at them that way? I've done it with VS.NET, I can't remember if VS 6.0 supports that or not (I think it does.)
"When a man sits with a pretty girl for an hour, it seems like a minute. But let him sit on a hot stove for a minute and it's longer than any hour. That's relativity." - Albert Einstein
|
|
|
|
|
Navin wrote:
I can't remember if VS 6.0 supports that or not (I think it does.)
Yes it does . It doesn't support re-saving on Win9x/ME though.
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"
|
|
|
|
|
Should have tried that.
Regards,
Brian Dela
|
|
|
|
|
How to make my app can not be seen from screen?
Any suggestion or direction are highly appreciated.
|
|
|
|