|
BOOL CAsyncSocket::Create(UINT nSocketPort, int nSocketType,
long lEvent, LPCTSTR lpszSocketAddress)
{
if (Socket(nSocketType, lEvent))
{
if (Bind(nSocketPort,lpszSocketAddress))
return TRUE;
int nResult = GetLastError();
Close();
WSASetLastError(nResult);
}
return FALSE;
}
as the "Communication Services" said, only servers need Bind . no clients need it
|
|
|
|
|
Well, the subject pretty much says it all - I've just noticed that in debug builds of my app, the Print Preview has its buttons in German. In Release builds, it's back in English.
I've gone all through the project settings, and everything's set to English (UK). Windows is set to English (UK). I can't find anything in the system set to German (although I may not be looking in the right places).
I created a new project from scratch with the MFC appwizard just to see if new projects had the same thing... and there were German print preview buttons.
I can't find any other common dialogues where it's appearing in German.
Any ideas as to what to look for? (before I lose any more hair! )
Thanks,
Andy Hassall (andy@andyh.org)
Space - disk usage analysis tool
|
|
|
|
|
This might be a totally wrong guess, but perhaps your printer driver has been installed with the german language pack
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
How can I get rid of this in a SDI app? Thanks for the help.
-Matt Newman
-Matt Newman
-Sonork ID: 100.11179:BestSnowman
|
|
|
|
|
Set it to something else. I'm guessing you're talking about a title bar? If so, use SetWindowText.
Without a more detailed question, I can't give a more detailed answer.
Hope this helps,
Bill
|
|
|
|
|
Sorry about that. I am talking about the title bar. Thats what I was looking for.
-Matt Newman
-Matt Newman
-Sonork ID: 100.11179:BestSnowman
|
|
|
|
|
In PreCreateWindow(), remove the FWS_ADDTOTITLE style.
--Mike--
My really out-of-date homepage
"Not our fault we are intellectually superior to the rest of the office." -- Paul Watson in the Lounge, 12/12/2001
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
I've tried to implement a dialog box so i can draw to it and make my own progress indicator, i tried using the CProgressCTRL class and have decided i could program my own, the only problem is that when i get a dc from the dialog box , it doesn't update after the first graphics command!
So i draw a white outline,and when i want to draw the progress in red for example it doesn't draw.
Infact it will only draw on the first graphics command the first time the OnDraw function is called unless i click off the dialog box, and then click back onto the dialog box and wait for it to update...
Please Help if u have drawn into a dialog box before... Also could u tell me the difference between WM_Paint and WM_Ncpaint
|
|
|
|
|
You're drawing direct to the dialog box ? You'll need to draw to a bitmap and then draw it in WM_ERASEBKGRD, otherwise your drawing will be erased by WM_PAINT.
WM_NCPAINT draws the non-client area ( the caption, etc. )
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
Hey all!
I use ShellExecute with "open" in my VC++ application to open a URL in the default browser. By default, IE "recycles" windows - it opens the new URL in some existing instance of itself. This must not happen - and I can't instruct each user to modify the settings in IE.
How do I open a URL, making sure it opens in a new IE window?
(Since the application is an ActiveX, I don't mind using IE to open the URL, and not the default browser. Is it possible to do this using some command-line parameters to IE? If so - what parameters should I use, and where in the registry to I find the location of IExplore.exe?)
Thanks!
|
|
|
|
|
start IE in this manner
iexplore.exe -new [url]
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Hi,
Greetings!
My application uses MFC document view architecture and it is an MDI Application.
When right clicked on the MDI child it creates and display another MDI Child window.
The newly created child window is displayed correctly but the previous background MDI child window also gets resized.
I think its window default behaviour to send the OnSize() message to all the MDI Child windows, whenever one of the MDI Child is created or
resized.
[To demonstrate easily this behavior open two files in VC++ IDE and Maximized them, now if the upper files is resized using min/max button
the second file is also gets resized.]
I don't want to resize the first MDI window (it's size should remain unchanged) if other MDI child window is created.
I found that MDIChild window receives WM_SIZING,
WM_SIZE & WM_GETMINMAXINFO.
The problem is that window sends these messages multiple times.
Till now I am trying to avoid the sizing using a flag; as I need to keep the previous MDIChil window Maximum I am using ShowWindow(...)
It does remain maximized but the MIN/MAX button
disappears.
This I think most likely because of multiple messages.
void CChildFrame::OnSize(UINT nType, int cx, int cy)
{
CMDIChildWnd::OnSize(nType, cx, cy);
if(m_bShowMax)
{
ShowWindow(SW_SHOWMAXIMIZED);
m_bShowMax = false;
}
}
Any idea about how to achieve it will be very helpful.
Regards,
Prashant
|
|
|
|
|
ok this is the deal. I've been making them little proggies lately ( alot of them, you know those address-book like things all based on file writing and lists) but i came to noticing that my computer was going slower and slower the longer it was on and i even had to reboot after a while cause i couldn't do anything anymore. I downloaded one of those ram-freeing proggies and that solved it, it came to the conclusion my memory was running out and i had to free it manually over and over again. So i thought "goddarnit, this doesn't have anything to do with my proggies i hope, maybe i got some memory-eating coding in there". So this is what i'm asking: If you consider yourself a good programmer, download the source of one of my proggies (given the link below) and take a look at it and PLEASE tell me if there's some kind of memory problem in it! I know the coding is pretty messy but that doesn't matter. I would also like to know if anyone else experienced this problem before.
(BTW the memory eating continues even after i shut them down so i'm not sure if its my proggies)
Link to source code: http://www.geocities.com/spidyvshades/IPlog.zip
AÐios
Kuniva
|
|
|
|
|
In Visual Studio, you can get some elementary memory leak tracking using your Debug build. When you finish running your program in the debugger, check out the "Debug" output window. At the bottom, if you have memory leaks, it should spew out a whole pile of stuff looking like:
Detected memory leaks!
Dumping objects ->
{23103} normal block at 0x017C96D0, 36 bytes long.
Data: < > 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
{23102} normal block at 0x017C97B0, 216 bytes long.
Data: < > FF FF FF FF FF FF FF FF 00 00 00 00 00 00 00 00
Object dump complete.
That means you've got memory leaks. To find out where they're occurring, you can double-click on them and Visual Studio *may* take you to the "new" statement that caused the problem. If not, I recommend you to a search on _crtBreakAlloc for a bit more info on how to track down the problems.
Other than that, if you're willing to pay money (and quite a bit, I think) you can use BoundsChecker (just search CP for it - it gets mentioned all the time).
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
ah, thank you for the help
Kuniva
|
|
|
|
|
I am trying to create a MFC dialog app that has a small amout of DX but I don't really know Win32 that well and all the examples are in win32 SDI window. Does anyone have any examples?
-Matt Newman
-Matt Newman
-Sonork ID: 100.11179:BestSnowman
|
|
|
|
|
Will somebody clear this up for me? Are they the
same?
And if so, are all future Visual C++ platforms going to
produce MISL code which would need a run-time
machine to interpret(yuck)?
|
|
|
|
|
I am not really sure but I think that you can choose to compile Managed (.Net) or Unmanaged code.
-Matt Newman
-Matt Newman
-Sonork ID: 100.11179:BestSnowman
|
|
|
|
|
lol
Kuniva
Want, take, have.
(oh btw, best way of learning some language is by looking at examples, start large!) :p
|
|
|
|
|
Satheesh Venkatesan wrote:
Will somebody clear this up for me? Are they the
same?
VC.NET is just a marketing name for VC 7.0
Satheesh Venkatesan wrote:
are all future Visual C++ platforms going to
produce MISL code which would need a run-time
machine to interpret(yuck)?
It is a matter of choice. You can compile your VC++ applications as managed (MISL) or unmanaged (native code). I pretty much believe that VC++ developers will continue to use the unmanaged mode, except for the interop with managed applications.
I vote pro drink
|
|
|
|
|
Is there any way to play MPEG file in VFW (Video for Windows)?
Jerzy
|
|
|
|
|
I need to feed a CString into a LPSTR. First, I simply assigned a CString to the LPSTR item like so:
lvitem.pszText = File.GetFileName ();
compiler error:
“no operator defined which takes a right-hand operand of type 'class CString'”
I then try typecasting it to a LPSTR…
lvitem.pszText = (LPSTR) File.GetFileName ();
complier error:
“cannot convert from 'class CString' to 'char *'”
Looking at CString’s methods, I see it can be typecast to a LPCSTR but not a LPSTR. So I try this:
lvitem.pszText = (LPCSTR) File.GetFileName ();
complier error:
“cannot convert from 'const char *' to 'char *''”
Ok, finally I typecast to LPCSTR then to a LPSTR. It compiles but the string is garbage.
lvitem.pszText = (LPSTR) (LPCSTR) File.GetFileName ();
Blah. I am new to MFC, but I can’t help but feel this a too much drama for a simple string .
Thx for any help.
|
|
|
|
|
The typical way to convert a CString to a LPSTR is to use CString::GetBuffer(...) and CString::ReleaseBuffer(...) which protect the CString from being mangled by the code playing with the LPSTR. Be sure to read the help for the CString overview and the functions just mentioned to see why. If your code doesn't modify the text, then it's often better to assign the CString to a LPCSTR variable, and then the compiler doesn't complain.
Another thing to keep in mind is that CString will try to keep just one copy of a piece of text when multiple CString's hold the same text. Using GetBuffer and ReleaseBuffer allow the CString to make a local copy of the text so that changing it via an LPSTR won't change the text of all the other CString's. (Which could be a bad thing.)
Dave Goodman
dgoodman@infoway.com
www.dkgoodman.com
|
|
|
|
|
|
The way to do this really depends on what you are trying to do. It looks
like you are trying to put the contents of a CString into a structure. You
may be best off making a copy of the string, and then deleting it
when you are finished using your strucutre. E.g.,
lvitem.pszText = new TCHAR[File.GetFileName().GetLength()];
strcpy(lvitem.pszText, File.GetFileName());
...
delete [] lvitem.pszText;
This is probably the safest way to do it, although it does mean
you create more memory for the string.
If you need an LPTSTR for, say, one function call, you can
use GetBuffer() to get the LPTSTR, and then ReleaseBuffer() after
you're finished.
It can be unsafe to cast a CString like this:
(LPTSTR)(LPCTSTR)someString
.. becuase if the contents of the LPTSTR are changed,
you can run into all kinds of nastiness (believe me, I know from experience. )
The early bird may get the worm, but the second mouse gets the cheese.
|
|
|
|