15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


question

Carl S CULLUM 3-1524 -- CULLUM.CARL@SMA1.MCCLELLAN.AF.MIL
Thursday, December 05, 1996

    Environment:  VC++ 1.52 or 4.1, Windows 95
    
    
    Q:  Is there an easy/convenient/abysmally difficult way to retrieve the 
    hardware address of an installed ethernet card on a PC?
    
    thanks.




Grant Shirreffs Great Elk -- Grant.S@greatelk.com
Monday, December 09, 1996

[Mini-digest: 3 responses]

It's in the MSVC documentation. Search for Q118623.


>----------
>From: 	Carl S CULLUM 3-1524
>Sent: 	Friday, 06 December 1996 7:49 AM
>To: 	mfc-l@netcom.com
>Subject: 	question
>
>    Environment:  VC++ 1.52 or 4.1, Windows 95
>    
>    
>    Q:  Is there an easy/convenient/abysmally difficult way to retrieve
>the 
>    hardware address of an installed ethernet card on a PC?
>    
>    thanks.
>
>
-----From: Mike Blaszczak 

At 10:49 12/5/96 -0800, Carl S CULLUM 3-1524 wrote:
>    Environment:  VC++ 1.52 or 4.1, Windows 95
   
>    Q:  Is there an easy/convenient/abysmally difficult way to retrieve the 
>    hardware address of an installed ethernet card on a PC?

If NETBIOS is installed, you can issue a call to the Netbios() API in
either Win16 or Win32. You'll need to get an NCB that requests the adapter
status for the adapter you want--part of the returned ADAPTER_STATUS structure
will tell you the physical address of the card.

The big catch here is that there might be many adapters on the system.

.B ekiM
http://www.nwlink.com/~mikeblas/
I'm afraid I've become some sort of speed freak.
These words are my own. I do not speak on behalf of Microsoft.

-----From: Jason Dale Woodward 

Environment: VC++ 4.0, Win95

Hello all-

	I'm having some difficulty working with PostThreadMessage().  I
have a bit of code I've added to an AppWizard generated SDI application:

	CWinThread *newThread;
	CRuntimeClass *cls = RUNTIME_CLASS(CTestThread);

	newThread = AfxBeginThread(cls);
	TRACE0("Sending a message...\n");
	TRACE1("Returned: %d\n", 
		PostThreadMessage(newThread->m_nThreadID,WM_COMMAND,
		(WPARAM) ID_JDW_MSG,0));



Which I believe places the WM_COMMAND message into the new thread's
message queue.  Now, I have a handler set up in CTestThread's message map:


class CTestThread : public CWinThread {
.....
protected:
	afx_msg void OnJdwMsg(void);
....
};

BEGIN_MESSAGE_MAP(CTestThread, CWinThread)
	ON_COMMAND( ID_JDW_MSG, OnJdwMsg )
END_MESSAGE_MAP()


void CTestThread::OnJdwMsg() {
	ofstream foo("c:\foobar.foo",ios::out);
	int i = 0;
	while (i < 20) {
		foo << "Test: " << i++ << endl;
	}
	foo.close();
	AfxEndThread(0);
}


Now, the call to PostThreadMessage supposedly sucessfully sends the
message because it returns 1 (TRUE).  However, my handler never gets
executed (no file on disk, no 'The thread 0xFFF3388D has exited with code
0' in the debug window).


My question is this:  Am I missing something about how messages are passed
down through handlers once the message loop gets a hold of it?  (i.e. is
my message never actually getting to CTestThread's message handler, and is
getting caught and discarded in it's parent class?)

Thanks for your time.

--
Jason Dale Woodward         Computer Science Undergrad, Cornell University
Univ Park Apts C204                    jdw5@cornell.edu jdw@cs.cornell.edu
Ithaca, NY 14850






| Вернуться в корень Архива |