|
Sir,
I am trying to find a unique machine of the computers listed in my network.
I can do it in 2 ways:By obtaining
1.IPAddress
2.MAC Address
Since IPAddress is subject to change and MAC address changes if there is change in the hardware configuration.
So the only way is to create a GUID of that machine.
The question is how one should go about in creating GUID.
I mean what are the functions should I use?
Is there any API?
I know that 2 utilities like GuidGen.exe and uuidGen.exe create unique GUIDS.
Pls guide
Regards
|
|
|
|
|
To programmatically create a GUID try calling CoCreateGUID() which can be found in objbase.h.
<code>
HRESULT CoCreateGuid(GUID* pguid);
</code>
Regards,
|
|
|
|
|
I hate to say this, but I fail to see how a GUID will uniquely identify a machine. In the past, GUID's were based on the MAC address. For security reasons, this is no longer true. As far as I know, it's based off the time and random values.
--
Joel Lucsy
|
|
|
|
|
Hi Dear,
How r u?
I use this code..but unable to set font in vc++ dialog box.
CStatic ArrayCaption;
ArrayCaption.Create(NULL,WS_CHILD|WS_VISIBLE,CRect(10,i*17,450,i*17+50),this,123);
ArrayCaption.SetWindowText("Sumit Kapoor");
I use
ArrayCaption.SetFont(&cFont1)
but that is not working
Any Hint please..
Thanks
---Sumit Kapoor---
|
|
|
|
|
Declare the fonts of the CFont type that you need in your dialog's class. Then in your class's OnInitDialog() function, define your font's style and then:
GetDlgItem(<controlIDHere> )->SetFont(<fontnamehere> );
That should do it.
Happy Programming and God Bless!
Internet::WWW::CodeProject::bneacetp
|
|
|
|
|
Hi..thanks for reply....
I create font by using this code:
CFont font;
LOGFONT lf;
memset(&lf, 0, sizeof(LOGFONT)); // zero out structure
lf.lfHeight = 22;
// request a 12-pixel-height font
strcpy(lf.lfFaceName, "Arial"); // request a face name "Arial"
font.CreateFontIndirect(&lf); // create the font
//then create
CStatic ArrayCaption;
ArrayCaption.Create(NULL,WS_CHILD|WS_VISIBLE,CRect(10,17,450,65),this,123);
ArrayCaption.SetWindowText("Sumit Kapoor");
// mine try...
//ArrayCaption.SetFont(&font)
// then your hint one but not working
GetDlgItem(123)->SetFont(&font);
you can copy paste this code & check..if doubt...
Thanks for help..bye
---Sumit Kapoor---
|
|
|
|
|
font is not exactly a member of your class, is it?
Do as suggested and create a CFont member variable. GetDlgItem will do the same as the direct reference ArrayCaption , so you should keep the ArrayCaption.SetFont - but have the class member as i parameter, of course. Remove SetDlgItem .
|
|
|
|
|
I forget what's in Also...
I want different font in my dialog..one line with one font & other with onother font...
Bye
---Sumit Kapoor---
|
|
|
|
|
Create your fonts on the Heap (using new)
Dont forget to delete (push in a list or something)
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
How to implement movement between button controls placed on a CFormView with arrow keys? Buttons are positioned like chessboard squares - so when the arrow key for left is pressed the focus should move to the button placed left and so on.
Should SetFocus() be overriden?
|
|
|
|
|
I have difficulties seeing what SetFocus should accomplish
You can, for example, add the arrow keys as accelerators in the accelerator table and map them to functions in your view.
|
|
|
|
|
I just want to move focus from one button to another, so the desired button can be activated by pressing ENTER.
It is possible to move focus with TAB key as well as with arrow keys, but focus goes from one button to the other as it was set in Layout -> Tab Order.
What I want to accomplish is to move focus in one of four directions using arrow keys, but I am not sure what's the best way to implement this behaviour.
|
|
|
|
|
dart13 wrote:
What I want to accomplish is to move focus in one of four directions using arrow keys
I understood that much, and I really think that you should try with accelerators. In the view - where you handle the message - you might want to check what control currently has the focus, and change it according to the pattern you want.
It is a button having the focus when the key is pressed, and therefore the keypress will be sent to the button (actually, the key up message will be sent... to the button the focus was moved to!). Therefore, the most basic place to handle this would be in a CButton -derived class.
But it is not a good way to solve the problem!
If you try handling the focus setting itself, you'll get into all sorts of grief, as changing the focus in a focus-handler (that is, a handler to WM_SETFOCUS ) will most probably get you in trouble.
Furthermore, if you handle this from the buttons themselves, you'll have to post messages to the owner anyway, as an individual button will have no knowledge of the other buttons on the view.
So, accelerators!
|
|
|
|
|
HI,
MY application (build with DirectShow and VC++) working fine to capture video
but a problm is I m using TV CARD + camera to capture video........
When my Computer Restarts or Reboots or i restart it after Shutting down
i need to run first Software of TV CARD ( ITS murcery Tv CArd)
then after closing it (TV card software)
I run my application ,,,, it works fine. and till again shutdown of Computer it works fine
IF i not run TV CARD software ,, My application not capture the video ..
I want to remove the dependency on TV CARD SOFTWARE..Y my application need to run it first ...
WT is the problm ,, is the TV cARD software DLLs load problm...
PLZ help me or any sampl code zahid_ash@hotmail.com
thanx ..
|
|
|
|
|
Hello,
In my program I dynamically create controls according to data read from a database. The control can be either CEdit or CComboBox. I also assign a unique control ID to each of the created controls (I know the ids).
Once controls created when a button pressed it's supposed to save controls values in the database.
Getting the text from the CEdit control isn't a problem as I just do GetDlgItemText(...). However, in case of the CComboBox I need to retrieve the ItemData using GetItemData. This is where I'm unsure of what to do.
I don't save anywhere if control with specific ID is a CComboBox or CEdit. Is is possible to know only by ID what kind of a control it is and to retrieve its original class?.
I was thinking just to make a struct:
struct {
CEdit *edit=NULL;
CComboBox *combo=NULL;
} myDynControls;
and then make an array of this struct. Each coresponding to an ID. I won't have more than 10 controls at a time.
What do you think? Is it a good idea? (i will delete everything after done working with ofcourse )
|
|
|
|
|
Hi Daredevil,
All MFC classes that derive from CObject (of which CWnd does) have a CRuntimeClass object associated with it.
So to see if your object is a CEdit control:
CWnd* pWndControl = m_arrMyControls[i];
if (pWndControl && pWnd->GetSafeHwnd())
{
CRuntimeClass* pClass = pWnd->GetRuntimeClass();
if (pClass)
{
CString strName = pClass->m_lpszClassName;
}
}
Hope this helps,
Andy
|
|
|
|
|
How about using IsKindOf() ?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi All,
Although the primary keys are working fine I am having terrible trouble getting the Index information.
Any ideas what I am doing wrong? Here is some code:
CIndexes rsIndex;
hResult = rsIndex.Open(m_session, NULL, NULL, NULL, tableData->sSchema, tableData->sName);
if(hResult == S_OK)
{
hResult = rsIndex.MoveNext();
while (hResult == S_OK) {
CString indexColumnName =
rsIndex.m_szColumnName;
indexes.Add(indexColumnName);
hResult = rsIndex.MoveNext();
}
}
I have tried it with 4 NULL's and not passing the schema name but it still gives me a zero record count.
Any ideas would be appreciated!
Thanks,
Chris
|
|
|
|
|
I developped a program to communicate on serial port com. It works fine on xp/W2000.
Then I wanted to include this into a bigger project, so I decided to change it into a dll. It works fine on W2000, but the same application using the same dll NEVER works on WXP. Does anybody have an idea about what could happen?
When I say it never works I mean that the thing that reiceives the data transferred on the serial link (I see the data transferred via a spy on the link) does'nt act as it really reiceived everything OK. I mean all the data are transferred, but it acts as if the flow was interrupted sometimes.
THANKS for your help!!!!
|
|
|
|
|
How can I add icon to main menu. (not use MFC).???
I have 2 files. First zasoby2.rc :
/////////////////////////////////////////////////////////////////////////////
//
// Menu
//
MOJEMENU MENU DISCARDABLE
BEGIN
POPUP "&Program"
BEGIN
MENUITEM "&Wyj?cie", IDM_WYJSCIE
END
POPUP "&Model"
BEGIN
MENUITEM "&Liniowy", IDM_LINIOWY
MENUITEM "&Nieliniowy", IDM_NIELINIOWY
MENUITEM "&Zerwanie", IDM_ZERWANIE
END
POPUP "&Pomoc"
BEGIN
MENUITEM "&O programie...", IDM_O_PROGRAMIE
END
END
Second menu1.h :
//zdefiniowane operacje menu
//#define IDM_NOWA 100
#define IDM_WYJSCIE 101
#define IDM_O_PROGRAMIE 102
#define IDM_LINIOWY 103
#define IDM_NIELINIOWY 104
#define IDM_ZERWANIE 105
//#define IDM_BLOKADA 106
#define IDI_IKONA1 210
#define IDI_IKONA2 220
#define IDI_IKONA3 230
#define IDI_IKONA4 240
//
#define IDC_MAIN_EDIT 111
#define IDC_MAIN_TOOL 112
What can I do ??
Please help!! Qdlaty
|
|
|
|
|
Hi,
I made a web browser using CHtmlView. it works perfactly. When i want to print a webpage it print with its own header & footer. I want to change these Header and Footer as i like.
If i get some help on this matter, it will relief a great pain.
Thanking you.
[Shumon]
|
|
|
|
|
I’m going to Serialize a class with CString and int-members to a file and then transfer it over the network. One of the members is a password-like one and I would like it to be encrypted before the serialization.
Any tip fore easy implementation.
...and justice for all
APe
|
|
|
|
|
|
HOW to Close the instance of application run by my COde..
if i have its HANDLE
????
thanx
|
|
|
|
|
That wont close anything.
I think he is saying how to kill an application started by his application when he has it's handle.
CloseHandle will close the Kernel handle - when the handles refrence count drops to 0, but wont actually close the spawnded process.
TerminateProcess() will very nastly kill a process given its handle.
|
|
|
|