|
Create a CStatic object on your dialog, and use the function CStatic::SetBitmap to switch between the different images that you want to use.
Good luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Hello,
I want to create an array for a listbox to list files that can be opened by my program, say everyfile in the same directory with the extension '.xyz'. How do I go about doing this?
|
|
|
|
|
FindFirstFile, FindNextFile
When history comes, it always takes you by surprise.
|
|
|
|
|
//following code is in a thread to read pipe input
while(bLoop)
{
b=ReadFile(hError,szBuf,500,&dwRead,0);
if((b==0)||(dwRead==0))
{
//line a: how to come to this line?
break;
}
//do something
}
//-----------------------------------------
line a is important because it is only break point of the thread.
from all of "exemples" and books, i found none of them really comes to the point of line a. they just exit from main process and leave it to OS.
sending a null string at other side of the pipe will not cause code going to line a.
i guess only error can do that.
any idea?
thx.
includeh10
|
|
|
|
|
The process on the other end of the pipe has to close its end for ReadFile() to return false. Reading from an empty (but still open) pipe is not an error, it just waits for data to appear in the pipe.
--Mike--
The Internet is a place where absolutely nothing happens.
-- Strong Bad
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
I'd like to increase the spacing between the items in report view of my owner-drawn CListCtrl. Does anyone know how to do this?
Thanks in advance.
|
|
|
|
|
Not quite sure about this. I create a modeless dialog in my MDI View class. Now at the click of a menu item I want this window to go away , and be completely gone from memory. If I just do a pMyDlg->ShowWindow(SW_HIDE) wont do away with it. SO how do I achieve this?
I could delete the pointer after SW_HIDE but is that the way one does these things? Or should some message be sent to the CDialog?
|
|
|
|
|
Use pMyDlg->DestroyWindow() . DestroyWindow() sends a WM_DESTROY message to the dialog, among other things. That's the legit way to close down a modeless dialog from 'outside' the dialog.
Since you used a pointer, I'll assume somewhere you have code like:
pMyDlg = new MyDlgClass(...);
If that's the case, you will still need to do this:
delete pMyDlg;
somewhere. If you are doing this, you could have the MyDlgClass destructor call DestroyWindow() . With that, you could just do the delete pMyDlg , and the destructor would close down the dialog for you.
Software Zen: delete this;
|
|
|
|
|
Exactly what I nneded to know, esp calling DEstroyWindow() in the destructor....many thanks
|
|
|
|
|
Hi,
I did improve my code to be flicker free and did some stress testing. Sometimes (very very seldom) it happens that my appliation crashs when resizing/scrolling my application like crazy for 1-2 minutes.
The MSVC debugger calling stack shows it has to do with CDC objects. Eighther adding or removing them from MFC's internal lists (temporary or permanent CDC list)... the code usually crashs inside a deeper heap management function.
I wonder if this is a common error with MFC?
I did stress test on different computers and different Windows. On some computers my app crashs on some never. - I'm not even sure if crashs are caused by my own failure. I checked all my drawing source code and it looks fine (all DCs states restored), also I have no memory leaks and it's just a single thread application.
Thanks for a feedback, Moak
PS: Using VC6 + SP5, Win32 Debug build
|
|
|
|
|
perhaps a problem with the DEBUG version of C runtime libraries (regarding Usenet postings)? I have a look if I have more luck with RELEASE version. however, a very anoying bug.
the calling stack looks like this:
_free_dbg_lk(void * 0x008a0880, int 4) line 1066 + 60 bytes
_free_dbg(void * 0x008a0880, int 4) line 1001 + 13 bytes
CObject::operator delete(void * 0x008a0880) line 46 + 12 bytes
CTempDC::`scalar deleting destructor'(unsigned int 1) + 34 bytes
CHandleMap::DeleteTemp() line 236 + 31 bytes
AfxUnlockTempMaps(int 1) line 51
CWinThread::OnIdle(long 1) line 594
...
|
|
|
|
|
When I build MFC app containing ComboBoxes using VC7 under WinXP, and then run this app under Win98se, in all ComboBoxes I see only currently selected item.
It happenes no metter how I add the items to Combo, even if I do it like
m_ComboBox.AddString(_T("First"));
m_ComboBox.AddString(_T("Second"));
m_ComboBox.AddString(_T("Third"));
m_ComboBox.SetCurSel(0);
in Win98 I see only "First".
Is some one ever had such a problem?
|
|
|
|
|
The expanded size of the combobox is too small. In the resource editor, click on the down-arrow in the combo, that will let you resize it vertically. (Well, that's how VC 6 works, no idea if VC 7 does it the same way)
--Mike--
The Internet is a place where absolutely nothing happens.
-- Strong Bad
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Hello, I'm trying to access the parallel port using Visual C 6.0, but every time the program shutdown with : Aplication error The exeption priviliged instruction....
I'am using in378=_inp(0x378);
does someone know some code to acces the parallel port in Win2k. I have seen some programs that give your aplication access to the port for Win2k, does someone know how they do that???
thankx for your time....
by the way Im new programming for Win2k...
Gpe. Ruiz
Equipment Engineer
guadalupe_e_ruiz@hotmail.com
|
|
|
|
|
Under Windows NT, 2000, and XP, the I/O instructions are privileged. That means that applications are not allowed to use them, period. Only device drivers are allowed to do I/O 'directly', and at that they don't use the I/O instructions; they end up calling functions in the 'hardware abstraction layer', and the HAL actually does the I/O.
That said, there are a number of packages out there that will let you do I/O via library calls. These packages include a device driver that the library uses to do the I/O. An example can be found here[^].
Software Zen: delete this;
|
|
|
|
|
Thanx. I will try to write a device driver to useit on my programs, but firts i will use the one on the link that you send me, thanx.
Gpe. Ruiz
Equipment Engineer
guadalupe_e_ruiz@hotmail.com
|
|
|
|
|
You will need the DDK. It's part of the MSDN subscription.
-Sean
----
Shag a Lizard
|
|
|
|
|
Ok, I'am subscribed to MSDN and have access to all DDK's, I will try to write a device driver to access the ports, Thankx for your time...
Gpe. Ruiz
Equipment Engineer
guadalupe_e_ruiz@hotmail.com
|
|
|
|
|
I am trying to write a program that will block any incoming traffic on a given port. I can handle all the threading aspect required. However, I am not sure how to write the actual code to block the port.
|
|
|
|
|
Is there a way I can use perl modules in my C++ program
|
|
|
|
|
can you advise me please how do I have to save information into a file? I have to store registration information of many users, so how can declare this.
|
|
|
|
|
You need to write a serializalble class containing your registration information. Here is a class that I wrote.
// SaveIP.h
//
#pragma once
// CSaveIP command target
class CSaveIP : public CObject
{
DECLARE_SERIAL (CSaveIP)
protected:
DWORD mID;
public:
CSaveIP(){}
CSaveIP( DWORD address, DWORD ID ){ mAddress = address; mID = ID; }
CSaveIP( const CSaveIP& src ){ mAddress = src.mAddress; mID = src.mID; }
DWORD mAddress;
CSaveIP& operator= (const CSaveIP& src);
void Serialize (CArchive& ar);
DWORD getAddress(void) { return mAddress; }
};
// SaveIP.cpp : implementation file
//
#include "stdafx.h"
#include "NSender.h"
#include "SaveIP.h"
IMPLEMENT_SERIAL (CSaveIP, CObject, 1)
// CSaveIP member functions
CSaveIP& CSaveIP::operator= (const CSaveIP& src)
{
if(this != &src)
{
mAddress = src.mAddress;
mID = src.mID;
}
return *this;
}
void CSaveIP::Serialize (CArchive& ar)
{
CObject::Serialize(ar);
if ( ar.IsStoring ())
ar << mAddress << mID;
else
ar >> mAddress >> mID;
}
|
|
|
|
|
Hi,
I am trying to read a binary file that has an array of n numbers from the hard disk.
I want to store these numbers in an array then display in a Edit box.
Any suggestions?
kash
|
|
|
|
|
Do you know the structure of the file? Is it a serialized CArray, or some other class?
I usually just use an ifstream, and the >> operator. But then again, I know ahead of time what I'm looking for in the file...
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
It's a 1 * n matrix (i.e. a column of number, size n) of varying precision generated by an external program to my MFC project. I guess I could find the size of the array by counting the elements.
kash
|
|
|
|