|
I was wondering that - especially since he's using std::string but then has to call c_str every time he wants to use the string.
Steve
|
|
|
|
|
((map + ".ml1").c_str()
Calling c_str on a temporary object like this is asking for trouble - Although I think it's probably safe in this instance.
Steve
|
|
|
|
|
Kixdemp wrote: Why won't it work?!
Most likely because you have not told us what the problem is.
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
Stephen Hewitt:
Initialized p... nothing.
Christian Graus:
I didn't know there was C++ file handling...
DavidCrow:
Oops... sorry! The problem is that it shows me a "Mazzee 2.exe has encountered a problem and needs to close. We are sorry for the inconvenience"
(Why is Microsoft sorry anyways? They didn't make my app...)
Hmm... I was wondering... how do you debug the app from the Release directory, where all the files needed are? Or, where does the debug run from? Thanks!
Lord Kixdemp
www.SulfurMidis.com
www.SulfurSoft.tk
[ftp://][http://][hotline://]tsfc.ath.cx
|
|
|
|
|
Actually... the problem's right here:
this->mapLayers = (char**)new char[3][(WIDTH/32)*(HEIGHT/32)];
I tried this:
this->mapLayers[1][3] = 'v';
I put a SDL_Delay(5000); before it, it delayed for 5 seconds, and then crashed. I put it after it, and it crashed immediately. What could be wrong with that declaration?
Thanks!
Lord Kixdemp
www.SulfurMidis.com
www.SulfurSoft.tk
[ftp://][http://][hotline://]tsfc.ath.cx
|
|
|
|
|
it is easy to get screen size in pixels.
but, how to get screen size in millimeters or inches?
A nice tool for optimizing your Microsoft html-help contents.
Includeh10
|
|
|
|
|
You need to look at the GetDeviceCaps API, in particular the HORZSIZE and VERTSIZE flags.
Steve
|
|
|
|
|
the function GetDeviceCaps is trick.
I tested several monitors but it doesn't work well.
currently I test with a 15 inch monitor, the function returns:
width=211, height=158.
it is not correct, actual size is over 270x210 mm^2.
what is problem?
A nice tool for optimizing your Microsoft html-help contents.
Includeh10
|
|
|
|
|
Does windows correcty report your monitor type?
Steve
|
|
|
|
|
not sure, what do you exactly mean?
photo-shop works well for any monitor, E.g. when display "print size", pictures are exactly the same size on screen as printed (E.g. for CD cover, I can put a real CD on monitor to compare its size).
A nice tool for optimizing your Microsoft html-help contents.
Includeh10
|
|
|
|
|
I mean when you right click on the desktop and select properties, go to "Settings" tab, press "Advanced" and go to "Monitor" tab what does it say there. Does it mention your monitor by name or does it just say "Plug and Play Monitor". My thinking is that if Windows doesn't know what type of monitor you have it may be guessing (wrongly).
If Photoshop knows this would seem not to be the case however, unless it knows because it was told by the user when it was installed.
The call I gave you is the way you go about find the information in Windows so I'm not sure what else to suggest.
Steve
|
|
|
|
|
no one told photo-shop about screen size when installed, it detects itself.
A nice tool for optimizing your Microsoft html-help contents.
Includeh10
|
|
|
|
|
Does this, or GetMonitorInfo() , help?
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
the functon doesn't work for NT,95 and some of 98.
we can not use this kind functions (excluding many users).
A nice tool for optimizing your Microsoft html-help contents.
Includeh10
|
|
|
|
|
Hi all,
I have a mdi app where the child frames are always maximized. I want to get rid of (remove completely) the child minimize and restore buttons, but keep the close button that appear on the menu bar.
So far, I have been able to disable the unwanted buttons in the CChildFrame::DefWindowProc function, by using
pSysMenu->DeleteMenu(SC_MINIMIZE,MF_BYCOMMAND);
pSysMenu->DeleteMenu(SC_RESTORE,MF_BYCOMMAND);
I understand that to actually remove the buttons, rather than just disable them, I need to handle the WS_NCPAINT message. Can anyone tell me how and where I would do this? (sample code perhaps)
Thanks in advanced,
-----------------
Genaro
|
|
|
|
|
Did you try ModifyStyle() or modify the window styles before its creation (in OnCreate() or else)?
I modified dialog in this way, it should work for other windows.
A nice tool for optimizing your Microsoft html-help contents.
Includeh10
|
|
|
|
|
I tried that, but perhaps I just used modifyStyle incorrectly.
Can you please send me a code snippet of how you did it?
Thanks,
-----------------
Genaro
|
|
|
|
|
try
UNIT uRemove=WS_MAXIMIZEBOX|WS_MINIMIZEBOX;
//call
pYourWnd->ModifyStyle(uRemove,0);
//or call
pYourWnd->ModifyStyle(uRemove,0,SWP_NOSIZE|SWP_NOMOVE);
A nice tool for optimizing your Microsoft html-help contents.
Includeh10
|
|
|
|
|
I have a dialog box with some buttons, etc, and I wanted to make the dialog box full screen, and I was able to do that without any problems(using the code below). But I noticed that when it's full screen, that basically my dialog box has been shifted to the top left corner, with rest of the screen filled in gray to create the "full screen" effect. What I really want is my dialog to be in the center, with gray filled in around it to create the "full screen" effect. Is there any possible way to do this? Thank you!
This is where my controls show up in full screen
-----------
xxx
-----------
I would like to have my controls show up in the middle of the full screen
-----------
----xxxx---
-----------
Code I have to make it full screen:
int cx, cy;
HDC dc = ::GetDC(NULL);
cx = GetDeviceCaps(dc,HORZRES) +
GetSystemMetrics(SM_CXBORDER);
cy = GetDeviceCaps(dc,VERTRES) +
GetSystemMetrics(SM_CYBORDER);
::ReleaseDC(0,dc);
// Remove caption and border
SetWindowLong(m_hWnd, GWL_STYLE,
GetWindowLong(m_hWnd, GWL_STYLE) &
(~(WS_CAPTION | WS_BORDER)));
// Put window on top and expand it to fill screen
::SetWindowPos(m_hWnd, HWND_NOTOPMOST,
-(GetSystemMetrics(SM_CXBORDER)+1),
-(GetSystemMetrics(SM_CYBORDER)+1),
cx+1,cy+1, SWP_NOZORDER);
-- modified at 17:52 Thursday 26th January, 2006
|
|
|
|
|
You would have to move all the child controls. You could do it something like this:
struct OffsetInfo
{
OffsetInfo(HWND hWnd, int OffsetX, int OffsetY):
m_hDialog(hDialog), m_OffsetX(OffsetX), m_OffsetY(OffsetY)
{}
HWND m_hDialog;
int m_OffsetX;
int m_OffsetY;
};
BOOL CALLBACK EnumChildProc(HWND hwnd, LPARAM lParam)
{
OffsetInfo* pInfo = reinterpret_cast<OffsetInfo*>(lParam);
RECT rc;
GetWindowRect(hwnd, &rc);
POINT pt = {rc.left, rc.top};
ScreenToClient(pInfo->m_hDialog, &pt);
pt.x += pInfo->m_OffsetX;
pt.y += pInfo->m_OffsetY;
SetWindowPos(hwnd, NULL, pt.x, pt.y, 0, 0, SWP_NOZORDER|SWP_NOSIZE);
return TRUE;
}
void CYourDialog::DoIt()
{
CRect rcBefore;
GetClientRect(&rcBefore);
CRect rcAfter;
GetClientRect(&rcAfter);
OffsetInfo oi(m_hWnd, (rcAfter.Width()-rcBefore.Width())/2, (rcAfter.Height()-rcBefore.Height())/2);
EnumChildWindows(m_hWnd, &EnumChildProc, reinterpret_cast<LPARAM>(&oi));
}
Note: I haven't tested this code but I believe that the concept is sound.
Steve
|
|
|
|
|
Steve,
Tried your solution, and works well!
Thank you very much!!
|
|
|
|
|
Hi all,
How can I manage the IP header of a TCP/IP Socket?
I know this is done using RAW sockets, I want some source code for TCP not UDP.
I have seen an example on the net but it did not work!
2nd Question: if I change my IP in the IP header and request some data via HTTP, would the data be sent to me or would it be sent to the new IP in the header??????????
Thank you all
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
|
I can answer your second question:
It will be sent to the IP that is set as source-IP in the outgoing header.
If your "real" IP was 10.127.3.54 and you change the header to read "Source-IP = 10.127.3.53", the answer to that packet will go to 10.127.3.53.
If there is an answer, that is. The target will simply drop most packets.
Oh, and if you are after messing the target up on purpose, you will (in most European, Asian and American countries) violate at least one law. Depending on where you are doing this from, you might get more than you expected in terms of response and jailtime.
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
Thank you man,
Really I am not in Euorpe nor in America... Regardless, I am here to learn some aspects of network programming
Thank you
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|