|
It wasn't meant that way, honest. With the topic he posted, there is just too much information he needs to grok before he can really get started, and I was trying to get him going in a direction where he could ask a more specific question. He did say 'inexperienced'.
Good luck, ric ric.
David
Debugging - The high art and magic of cussing errors into 'features'
|
|
|
|
|
Ah.
Me, I would probably have gone with the "sarcasm" approach. But then I never claimed to have patience. My wife's a teacher, but I'm too much of a bastard for that.
|
|
|
|
|
For a computer running win2k/xp how can i programmatically find the path to the Windows directory ?
|
|
|
|
|
|
This should get you started:
wString rmw::iniFilePath() {
wString path;
ITEMIDLIST * list;
HRESULT hr = SHGetSpecialFolderLocation(NULL, CSIDL_APPDATA, &list);
if (!SUCCEEDED(hr)) path = TEXT("C:\\");
else {
TCHAR str[MAX_PATH+1] = {0};
if (SHGetPathFromIDList(list, str) == TRUE) {
path = str;
}
}
CoTaskMemFree(list);
return path;
}
You will need to sub std::string for wString, and 'CSIDL_WINDOWS' for the CSIDL_APPDATA, and make a couple other changes.
Debugging - The high art and magic of cussing errors into 'features'
|
|
|
|
|
GetWindowsDirectory()
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
GetSystemWindowsDirectory
Vipin - MVP
|
|
|
|
|
just a clarification.
"The GetSystemWindowsDirectory function retrieves the path of the shared Windows directory on a multi-user system."-msdn.
so does this suit the question?
VuNic
|
|
|
|
|
Another question:
Before calling the dialog, I try to call another function, which has access to the list elements. This function should fill the CListBox. But every time, I will add this elements to the CListBox (using AddString("text")), the program returns a error message. Whats the mistake?
Help!
|
|
|
|
|
hanno25 wrote: the program returns a error message
What message? The message that you get is telling you what is wrong. If you want help you have to let us know what the message is or else all we can do is take a guess.
My guess is that the CListBox window is not yet created when you call AddString() so there is no HWND to handle the LB_ADDSTRING message, resulting in an ASSERTion being thrown in CListBox::AddString().
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
you cannot access your dialog Items before initializing your dialog.
BOOL CMFCDlg::OnInitDialog()
{
}
VuNic
|
|
|
|
|
you may add ur code into initdialog function that insert the elements into the list box
BOOL CTestDlg::OnInitDialog()
{
CDialog::OnInitDialog();
//my code for adding the data into listbox
}
Thanks and Regards
Laxman
FAILURE is the first step towards SUCCESS
|
|
|
|
|
Hi,
I would like to know if there is a way to copy partial memory contents(variables) from one structure to another using the memcpy function.
ie
struct TEMP{
int x;
int y;
int z;
};
I would like to copy the struct TEMP except the variable int z, to another struct TEMP?
Thanks
|
|
|
|
|
you could do : memcpy(&destStruct, &sourceStruct, sizeof(int) * 2);
but that's only good if the stuff you want to skip is on the end of the struct.
Cleek | Image Toolkits | Thumbnail maker
|
|
|
|
|
Chris Losinger wrote: you could do : memcpy(&destStruct, &sourceStruct, sizeof(int) * 2);
but that's only good if the stuff you want to skip is on the end of the struct.
It probably works but the code is not safe and portable. The only guarantee is that the first data member and the struct have the same address (no virtual functions involved).
-- modified at 5:18 Sunday 29th January, 2006
A portable solution is:
memcpy(&destStruct, &sourceStruct, offsetof (TEMP, y) + sizeof(int));
|
|
|
|
|
Hi!
I try to fill a CListBox with elements of a CList object. The elements should be listed, as soon as the dialog will be opened. So, I have to do this via "OnInitDialog". But to get access to the list elements, OnINitDialog needs one parameter in his parameterlist.
Does somebody know, how I can overwrite this function?
Thanks a lot, hanno
|
|
|
|
|
|
Hello everyone!
OK, I posted a question 1 or 2 days ago about this... I already solved that problem, but now I'm facing another one!
The problem is that the maps don't load up correctly... Here's the ObjectType enumeration:
enum ObjectType<br />
{<br />
LX_EMPTY,<br />
<br />
L1_GRASS,<br />
<br />
L2_ROCK,<br />
<br />
L3_TELEPORTER,<br />
};
Here's some previous declarations needed to understand the troublesome methods:
<br />
#define WIDTH 512<br />
<br />
#define HEIGHT 384<br />
<br />
#define CHARW 32<br />
<br />
#define CHARH 32<br />
<br />
SDL_Surface ** mapLayerTiles;<br />
<br />
ObjectType mapLayers[3][WIDTH*HEIGHT];<br />
<br />
SDL_Surface * screen;<br />
Here's the method that loads the map layers:
void Mazzee::GetMapInfo(std::string map)<br />
{<br />
FILE * f[3] = {<br />
fopen((map + ".ml1").c_str(), "rt"), <br />
fopen((map + ".ml2").c_str(), "rt"), <br />
fopen((map + ".ml3").c_str(), "rt")<br />
};<br />
<br />
<br />
for (int x = 0; x < 3; x++)<br />
{<br />
if (f[x] == NULL)<br />
exit(1);<br />
}<br />
<br />
<br />
for (int x = 0; x < 3; x++)<br />
{<br />
int p = 0;<br />
while (p < (WIDTH/32)*(HEIGHT/32))<br />
{<br />
<br />
if (feof(f[x]))<br />
return;<br />
<br />
char v = fgetc(f[x]);<br />
<br />
<br />
switch (v)<br />
{<br />
case '.':<br />
this->mapLayers[x][p] = LX_EMPTY;<br />
++p;<br />
break;<br />
<br />
case '|':<br />
this->mapLayers[x][p] = L1_GRASS;<br />
++p;<br />
break;<br />
<br />
case 'o':<br />
this->mapLayers[x][p] = L2_ROCK;<br />
++p;<br />
break;<br />
<br />
case 'T':<br />
this->mapLayers[x][p] = L3_TELEPORTER;<br />
++p;<br />
break;<br />
<br />
<br />
}<br />
}<br />
<br />
<br />
fclose(f[x]);<br />
}<br />
}
And here's the method that displays the map on the screen:
void Mazzee::DrawMap()<br />
{<br />
for (int x = 0; x < (WIDTH); x += CHARW)<br />
{<br />
for (int y = 0; y < (HEIGHT); y += CHARH)<br />
{<br />
for (int v = 0; v < 3; v++)<br />
{<br />
SDL_Rect src, dest;<br />
<br />
if (v == 0)<br />
{<br />
if (this->mapLayers[v][(x/32)*(y/32)] == LX_EMPTY) src.x = 0;<br />
else if (this->mapLayers[v][(x/32)*(y/32)] == L1_GRASS) src.x = 32;<br />
}<br />
else if (v == 1)<br />
{<br />
if (this->mapLayers[v][(x/32)*(y/32)] == LX_EMPTY) src.x = 0;<br />
else if (this->mapLayers[v][(x/32)*(y/32)] == L2_ROCK) src.x = 32;<br />
}<br />
else if (v == 2)<br />
{<br />
if (this->mapLayers[v][(x/32)*(y/32)] == LX_EMPTY) src.x = 0;<br />
else if (this->mapLayers[v][(x/32)*(y/32)] == L3_TELEPORTER) src.x = 32;<br />
}<br />
<br />
src.y = 0;<br />
src.h = CHARH;<br />
src.w = CHARW;<br />
<br />
dest.x = x;<br />
dest.y = y;<br />
dest.h = CHARH;<br />
dest.w = CHARW;<br />
<br />
SDL_BlitSurface(this->mapLayerTiles[v], &src, this->screen, &dest);<br />
}<br />
}<br />
}<br />
}
Here's the map files:
<br />
map1.ml1:<br />
...............<br />
...............<br />
...|...........<br />
...............<br />
...............<br />
...............<br />
...............<br />
.........|.....<br />
...|...........<br />
...............<br />
...............<br />
...............<br />
<br />
map1.ml2:<br />
o.............o<br />
...............<br />
...............<br />
...............<br />
..............<br />
...............<br />
...............<br />
...............<br />
...............<br />
...............<br />
...............<br />
o.............o<br />
<br />
map1.ml3:<br />
...............<br />
...............<br />
..T............<br />
...............<br />
...............<br />
...............<br />
...............<br />
...............<br />
...............<br />
...............<br />
............T..<br />
...............<br />
Sorry for making it long... Thanks!
Lord Kixdemp
www.SulfurMidis.com
www.SulfurSoft.tk
[ftp://][http://][hotline://]tsfc.ath.cx
|
|
|
|
|
Hi all!
I used the Chris Maunder's Systray code to implement a systray with a popup menu, but i can't figure how to set a subitem checked!
I used the SetMenuItemChecked but it failed!!
I cant go on with this!! And i can't use Chris' classes with these stuffs too because they are for Mfc projects (mine is not mfc) !!
HELP ME PLEASE!!! (
---
|
|
|
|
|
|
You mean putting ON_UPDATE_COMMAND_UI as a switched case of the main dialog msg?
Like this?
case WM_INITDIALOG:
{
....
break;
}
case ON_UPDATE_COMMAND_UI:
{
//What to do here??
break;
}
---
|
|
|
|
|
|
Hi,
How can i find the selected row and read the cell values with mouse click event using the MS DataGrid v6 ActiveX Control ?
Regardsm
sdancer75
|
|
|
|
|
Hi all
Can any one post a sample source code for counting the number of children excluding the grand children in a particular node in a Tree
Lovekesh
|
|
|
|
|
If I understand your question correctly you want to count the immediate children of a node. If this is the case code like this should do it:
UINT Count = 0;
HTREEITEM hItem = m_Tree.GetChildItem(hRootItem);
while (hItem != NULL)
{
++Count;
HTREEITEM hNextItem = m_Tree.GetNextSiblingItem(hItem);
}
NOTE: I haven't actually tried this! Assumes you're using MFC (although it is easily adaptable if you're not).
Steve
|
|
|
|