|
you can handle WM_ACTIVATE message. WPARAM of WM_ACTIVATE message specifies you whether the window is activated or deactivated.
- Malli...!
|
|
|
|
|
hi i am doing c programming
i am trying to do struct pointer but i cant seems to get it to work:
struct person<br />
{<br />
int a;<br />
}<br />
<br />
int main()<br />
{<br />
struct person* start;<br />
<br />
start = malloc(sizeof(struct person));
func(start);<br />
<br />
<br />
return 0;<br />
}<br />
<br />
void func(struct person* inc)<br />
{<br />
struct person* newnode;<br />
newnode = malloc(sizeof(struct person));
inc = newnode;<br />
}<br />
|
|
|
|
|
Pointers, as other argument types, are passed by value.
BTW you're code is messy, What are you trying to do?
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.
|
|
|
|
|
sry about the messy code.
basically i am trying to do link list.
-i create a pointer to be the head_node in my main
-i pass by pointer the address of the head_node to the function
-in the function i create a new_node
-then i TRYED to set the new node address to the head_node via the passed in pointer
however it cant seems to work..
so does anyone got any idea how to pass in by reference???? thx
|
|
|
|
|
If you have to implement a linked list, then your structure must have pointer member at least(to address the next element or the end of the list).
Here you can find some info [^], there are a lot of good articles about here at CP (see, for instance The Basics of Linked Lists and Binary Trees).
I suggest some background about pointers too (have a look to a good C programming book).
Hope that helps.
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.
|
|
|
|
|
neodeaths wrote: inc = newnode;
This should probably be:
inc->a = newnode->a;
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
I added ON_WM_CTLCOLOR message handler in the code. In OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
pDC->SetTextColor(RGB(255,255,255));
m_check1.DrawCaption(pDC,NULL,nCtlColor); //here for the second parameter which is LPCRECT what i should pass?
Will that work?
|
|
|
|
|
Try it out... If doesn't work, debug and post lines where it fails. If it DOES work... voilá/eureka/tantatachán
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
It didn't work. It disn't throw any error message but the caption text color is default black where i wanted this one to be in white.
HBRUSH DlgTest::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hBrush = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
pDC->SetTextColor(RGB(255,255,255));
//pDC->SetBkColor(RGB(230,250,210));
m_check1.DrawCaption(pDC,NULL,nCtlColor);
return(hBrush);
}
Where did i go wrong?
-- modified at 1:52 Friday 16th November, 2007
|
|
|
|
|
I don't know where the error is, but if you do want to have the caption of the radio button in a particular color, there is another solution (not so professional, but works). Empty the caption (nothing in ""), create a font with the color that you want and set the BkMode to transparent (if you dont want the letters to have a square background), then use the easy TextOut and write the caption manually
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Did you have any compiler for check it?
|
|
|
|
|
Also how to count no.of folders/no. of files? in VC++ MFC.
|
|
|
|
|
Use ::CreateDirectory (...) to create a folder.
Or
::SHCreateDirectoryEx (...) to make a deep path of directories
As for counting files, you'll have to use FindFirstFile / FindNextFile to get a list of files/directories in a directory. You can check the WIN32_FIND_DATA structures dwFileAttributes for a FILE_ATTRIBUTE_DIRECTORY flag to see if it's a directory.
Good luck,
Iain.
|
|
|
|
|
http://msdn2.microsoft.com/en-us/library/aa365522.aspx
there you go.
|
|
|
|
|
Or you can use of dlgdirlist for get folder and file names and count.
|
|
|
|
|
hi,
1. how can i capture a window (dialog) that is under another window?
2. also, is it possible to force a window to be display off screen, e.g.
i use findwindow to find the window, and then move it to offscreen for
display.
3. i'll then capture the window that is offscreen and put into another window
for display.
thanks.
br,
calvin
|
|
|
|
|
|
How to recognize whether selected font is printer font?
Any APIs.
|
|
|
|
|
hey ,i met with a problem here~ i wanna find a code snippet which can read the "*.hgt" file
does anyone know where i can get this?
thanks a lot
|
|
|
|
|
The extension of a file is not the problem to read a file. You can use CFile/CArchive or any other possibility to open almost all extensions. The most important things are: Which saving mode has it? Binary, plain Text, UNICODE... and how is the structure of saved data (i.e. The first 30 Bytes is a header where 4 parameters mean 4 different things, then come 30 Bytes for a string, after 10x1 Byte for unsigned shorts, then a 10x20 Bytes to a matrix of...)
I want to mean... can you be a bit more concrete?
BTW, have you tried google?
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
first ,thank u for ur attention
yeah , you got the point~ "The most important things are: Which saving mode has it?"
and this is also where the problem lies ,thats i have no idea of whats the structure of this ".hgt" file
someone told me perhaps its NASA Shuttle Radar Topography Mission files
but i am still not sure
|
|
|
|
|
Then... I think ready code will be not easy to find, and without the structure and meaning of every data unit... practically impossible to code it. Good luck
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Nelek wrote: I think ready code will be not easy to find
yeah i think so~
hehe thank u very much all the same
|
|
|
|
|
if you don't know what the file is, why would you want to open it ?
you just have a file with that extension and just have the urge toopen it ?
|
|
|
|
|
hehe
all i know about this file is its a 3D map,i just have no idea what the structrue of this file is~~
however after i checked some websites i am partly sure its a Shuttle Radar Topography Mission file~
have u got any idea for this?
|
|
|
|