|
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
|
|
|
|
|
Hi steven
the above code is not working
the while loop is iterating continously and it is not at all terminating
can u suggest me why it is happening
-- modified at 9:57 Saturday 28th January, 2006
|
|
|
|
|
Oops, it should look like this:
UINT Count = 0;
HTREEITEM hItem = m_Tree.GetChildItem(hRootItem);
while (hItem != NULL)
{
++Count;
hItem = m_Tree.GetNextSiblingItem(hItem);
}
Steve
|
|
|
|
|
Hi stephen
I ve written another code for my problem it works for me
but if i want to retreive the child including its children
and to retreive parent of a child
how the code willbe look like
-- modified at 4:13 Sunday 29th January, 2006
|
|
|
|
|
I want a MDI app withOUT a menu, any menu.
With a SDI all I have to do is override PreCreateWindow() as follows:
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs)
{
cs.hMenu = NULL; // no menu
return CFrameWnd::PreCreateWindow(cs);
}
This will not work for MDI (vs. SDI). Any ideas?
|
|
|
|
|
In the app after mainframe creation
m_poMainFrame->SetMenu(NULL);
In a custom CMdiClient intercept and eat
ON_MESSAGE(WM_MDISETMENU , OnMDISetMenu )
ON_MESSAGE(WM_MDIREFRESHMENU, OnMDIRefreshMenu)
|
|
|
|
|
HI joey Bloggs!
thank you for your reply!
i add the SetMenu(NULL).it works!@thank you very much,
but still has problems..
I add the micros to the ChildFrame as you metioned manually(there isn't WM_MDISETMENU message in my class wizard of VC6)as follow:
in the childfrm.cpp:
BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWnd)
ON_MESSAGE(WM_MDISETMENU , OnMDISetMenu )
ON_MESSAGE(WM_MDIREFRESHMENU, OnMDIRefreshMenu)
END_MESSAGE_MAP()
and int the childfrm.h i add :
afx_msg void OnMDIRefreshMenu();
afx_msg void OnMDISetMenu();
but int the functions OnMDISetMenu() and OnMDIRefreshMenu(),it can't receive the message WM_MDISETMENU and WM_MDIREFRESHMENU!
could you explain it detailedly?
thanks a lot!
|
|
|
|
|
It's not ChildFrame it's MDIClient that you need to customise
class CMdiClient : public CWnd<br />
{<br />
.<br />
.<br />
.<br />
afx_msg LRESULT OnMDIMaximize (WPARAM wParam, LPARAM lParam);<br />
afx_msg LRESULT OnMDIRestore (WPARAM wParam, LPARAM lParam);<br />
afx_msg LRESULT OnMDISetMenu (WPARAM wParam, LPARAM lParam);<br />
afx_msg LRESULT OnMDIRefreshMenu(WPARAM wParam, LPARAM lParam);<br />
}
Then make CMdiClient a member of MainFrame and subclass it in the create
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)<br />
{<br />
if (CMDIFrameWnd::OnCreate(lpCreateStruct) == -1)<br />
{ <br />
return -1;<br />
}<br />
<br />
if (!m_oMdiClient.SubclassWindow(m_hWndMDIClient))<br />
{<br />
MYTRACE(_T("Failed to subclass MDI client window\n"));<br />
return -1;
}<br />
-- modified at 1:53 Tuesday 11th April, 2006
|
|
|
|