|
Hi folks
Just a simple question I reckon..
I am doing a couple of easy C++ programs from books. Whereas before in VC++ 6.0 I used to get a console which displayed my program output and 'Press any
key to continue', I find that the same code in VS.NET flashes a console up
and it disappears instantaneously. I've gotten round this by putting something like
int abc;<br />
cin >> abc;
at the end of a main() before I return, but I was wondering if there was a
project setting I can use to bring back the 'Press any key' thingy.
Thanks for any help..
J
|
|
|
|
|
Im using a listbox to display read-only data, i.e. like a history box, or something like the "output" toolbar/window at the bottom of the standard VC++ interface(although you can click those items). Normally, as every item is added to a listbox, its appears below the previous one. Is there any way to make the most recent item appear first on the list box? This format seems preferable for something like a history/process box which im using to watch exactly what the program is doing since i make it send a string to the list box when a new function is performed. Any ideas?
Cheers,
Ayush
|
|
|
|
|
Use CListBox::InsertString (0, _T("Some text")); .
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hi all
I want an application , which can trace the Email origin ,ie from where the Email actualy coming frm(The Details abt the ISP,IP address etc..),Is here any articles discussing about that..? or any Idea abt how it is possible.
Thank You
Mad Coding.
|
|
|
|
|
i have some different status icons for every item in a list. i wish that i can change these icons in each item dynamically.
now it's very strange because my code works well under Win32 Debug's build but not for Win32 Release's, under Win32 Release's build the icons cannot be updated!
below are my current implementation, wish someone can help me to find out the problem. thanks a millions in advance!
-----------------------------------------------------------------
Initializations:
-----------------------------------------------------------------
CListCtrl lsclMyList;
CImageList imgls4MyList;
HICON hIcon0, hIcon1;
imgls4MyList.Create(16, 16, ILC_COLOR16 | ILC_MASK, 2, 1 );
hIcon0 = reinterpret_cast<hicon>(
::LoadImage ( AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_ICON0),
IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR ));
hIcon1 = reinterpret_cast<hicon>(
::LoadImage ( AfxGetResourceHandle(), MAKEINTRESOURCE(IDI_ICON1),
IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR ));
imgls4MyList.Add ( hIcon0 );
imgls4MyList.Add ( hIcon1 );
lsclMyList.SetImageList ( &imgls4MyList, LVSIL_SMALL );
-----------------------------------------------------------------
1st Time Insert Item:
-----------------------------------------------------------------
LVITEM lvItem;
lvItem.mask = LVIF_TEXT | LVIF_IMAGE;
lvItem.iItem = 0;
lvItem.iImage = 0;
......// other text info
lsclMyList.InsertItem(&lvItem);
-----------------------------------------------------------------
Update Item's Icon:
-----------------------------------------------------------------
LVITEM lvItem;
lvItem.mask = LVIF_IMAGE;
lvItem.iItem = 0;
lvItem.iImage = 1;
lsclMyList.SetItem(&lvItem);
anyone knows why? i don't know where's the problem because it's working under Win32 Debug's build, there it can update the icon as i wanted. but it's so odd that when i build it for Win32 Release, the icon never changed!
programming+soccer = my current life
|
|
|
|
|
try this:
ZeroMemory(&lvItem, sizeof (LV_ITEM));
before setting your members.
in debug mode, those structs are probably being initialized to zeros. but in release mode they just have some random garbage in them.
-c
"[it was..] one of those evenings when you feel that not only will there definitely be a revolution, but that the Association of Manufacturers will foot the bill."
-- Umberto Eco, Foucault's Pendulum
|
|
|
|
|
Thanks a lot, Chris! it's working now with ur solution!
programming+soccer = my current life
|
|
|
|
|
IIRC it's the iSubItem member not initialized. However, it's always good idea to Null Windows structs before filling them (unless you're very very tight with speed).
Curiously, the struct will no be initialized to 0 in debug mode, but to some other bit mask (I think it's 0xCC).
Global structures will be null'ed in debug and release builds
Auch den Schatten will ich lieben weil ich manchmal lieber frier' Rosenstolz [sighist]
|
|
|
|
|
Thanks a lot, !
i just tried without null the whole structure but only set the iSubItem to 0, it's also working!
programming+soccer = my current life
|
|
|
|
|
for (; !Free; ) ;<br />
Free = FALSE;<br />
<br />
what does the for loop means! I only see for(; ; ) not the above.
Thanks
|
|
|
|
|
it is the same as while(!Free)
for (initialize ; test ; increment)
"[it was..] one of those evenings when you feel that not only will there definitely be a revolution, but that the Association of Manufacturers will foot the bill."
-- Umberto Eco, Foucault's Pendulum
|
|
|
|
|
As Chris pointed out, this is equivalent to
while(!Free); This makes little sense except in a multithreaded context where you're expecting some other thread to release a resource marked by Free . In fact, the snippet looks like a (very badly behaved) simulacre of EnterCriticalSection .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
Watch that line! You've got a ; (semicolon) right after. You'll be in an endless loop, and Free will never get set to FALSE :
while (TRUE == Free)
{
Free = FALSE;
}
Seems redundant, but I explicitly test for TRUE because who knows what magic numbers (#define d) mean.
-- ian
http://www.ian-space.com/
|
|
|
|
|
My dialog project include a Strmbasd.lib file,
When I build it,5 LNK2005 errors appear:
strmbasd.lib(wxutil.obj) : error LNK2005: "public: __thiscall CCritSec::CCritSec(void)" (??0CCritSec@@QAE@XZ) already defined in TestDlg.obj
In the lib file the following class was defined:
CCritSec::CCritSec() <br />
{<br />
.......<br />
}<br />
<br />
CCritSec::~CCritSec() <br />
{<br />
.......<br />
}<br />
<br />
void CCritSec::Lock() <br />
{<br />
.......<br />
}<br />
<br />
void CCritSec::Unlock() <br />
{<br />
.......<br />
}
In my project the following class was defined
class CMemStream : public CAsyncStream <br />
{<br />
public:<br />
.......<br />
void Lock()<br />
{<br />
.....<br />
}<br />
void Unlock()<br />
{<br />
......<br />
}<br />
.......<br />
<br />
};
How to solve the problem?
|
|
|
|
|
are you #include'ing the CCritSec header in the EXE? is there any implementation in that header?
-c
"[it was..] one of those evenings when you feel that not only will there definitely be a revolution, but that the Association of Manufacturers will foot the bill."
-- Umberto Eco, Foucault's Pendulum
|
|
|
|
|
I don't include the CCritSec header, the CCritSec class was defined in the lib file.
In my project defined the following class:
class CMemStream : public CAsyncStream <br />
{<br />
........<br />
void Lock()<br />
{<br />
m_csLock.Lock();<br />
}<br />
void Unlock()<br />
{<br />
m_csLock.Unlock();<br />
}<br />
<br />
private:<br />
CCritSec m_csLock;<br />
}; In another header file CAsyncStream was defined, the header file was included in my project.
class CAsyncStream<br />
{<br />
public:<br />
........<br />
virtual void Lock() = 0;<br />
virtual void Unlock() = 0;<br />
};
|
|
|
|
|
Hi,
when the explorer crashs the system tray icons are usually gone. I found out that e.g. mIRC detects this and recreates it's system tray icon (great!). How can I do this?
PS: The CSystemTray class from Chris Maunder does not handle this AFAIK (I use it).
|
|
|
|
|
The shell broadcasts a message to all top-level windows when the tray is re-created. Call RegisterWindowMessage(_T("TaskbarCreated")) to get the ID of the message.
--Mike--
"I'd rather you just give me a fish today, because even if you teach me how to fish, I won't do it. I'm lazy." -- Nish
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Hi,
I'm new to C++/MFC.
I have an assignment to modify the Chat program from the MSDN site (Chatter and Chatsrvr) to cater for file transfer.
I need to determine between data
that is being sent over the socket as text (the messages) versus the binary
data that is to be sent over as the file. There is a void
CClientSocket::OnReceive(int nErrorCode) looks like an overrided method
from the CSocket class. So basically whenever the socket receives
something, it kicks off the OnReceive code. It
calls the ProcessPendingRead method , which then treats the
received data as a Message (text) versus a binary file.
How can I switch between data the text for the messages and the binary data for the file when I'm doing the file transfer?
Any ideas on how to make this work?
Pett
|
|
|
|
|
Hi,
for example make a new client socket that does not send/receive chat text, but instead only receives (binary) data.
You can derive a new class from your CClientSocket, so it's more clear that this class has a single purpose (downloading files). On the server side you might need to add more handshake to distinguish between incoming clients and incoming file requests (I don't know what Chatter and Chatsrvr do).
Propably you wanted to transfar text and binary data via one socket... but this might not be good if transfering bigger files. While transfaring the user couldn't chat anymore and the server can't send chat text. Creating a new socket for file transfar solves this problems.
Hope it helps, Moak
|
|
|
|
|
i've got the memory location as follow
addres1: 0x00322360
addres2: 0x0032236c
which one is greater! Thanks
|
|
|
|
|
Number 2
Regards,
Brian Dela
|
|
|
|
|
Hi there.
Im working on a project at the moment a sort of Search program if you will. However there is obviously going to be a problem with the system if the user doesnt use it for so many days, files will have been deleted / created / modified etc.
A solution would be a small program which logged files changes to a text file. Such as new files created, modified, moved, deleted etc. This file would be loaded by the main app and the database updated.
I have researched Visual Basic and found out about "hooks". However i dont believe these stretch to this kind of activity and as ill link to below the program below uses C++.
The following program does what i want i suppose, and the source code is free, but theres no explanation to much of it and i was wondering if anyone had tutorials / source code on this complex thing.
http://www.sysinternals.com/ntw2k/source/filemon.shtml
Thanks greatly.
Gavin
|
|
|
|
|