|
Hi
you have to check that in the registry;
so write code for that
|
|
|
|
|
If you know the relevant GUID s you can call CoGetClassObject or CoCreateInstance and check the return value.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
I have some code below, which uses the disk management code IOCTL_DISK_GET_DRIVE_LAYOUT. However, when I run the application, the error code 122 is produced (indicating that the DRIVE_LAYOUT_INFORMATION structure - which is pointed to - is too small). How would I rectify this problem?
Here is the code below:
<br />
BOOL GetDriveLayout()<br />
{<br />
BOOL bResult;<br />
DWORD dwRet =0;<br />
DRIVE_LAYOUT_INFORMATION p;<br />
<br />
bResult = DeviceIoControl(hDevice,IOCTL_DISK_GET_DRIVE_LAYOUT,NULL,0,&p,sizeof(p),&dwRet,NULL);<br />
<br />
if(bResult==FALSE)<br />
printf("Error: %d", GetLastError());<br />
<br />
return bResult;<br />
}<br />
Note that other IO functions such as IOCTL_DISK_GET_PARTITION_INFO work fine..
Thanks for your help!
--PerspX
"Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates
|
|
|
|
|
Depending on your OS version you could need to use DRIVE_LAYOUT_INFORMATION_EX which is documented here[^] and IOCTL_DISK_GET_DRIVE_LAYOUT_EX . You might want to consider using IoReadPartitionTableEx[^] to retrieve the partition information as well.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Thanks I sorted the problem out myself but I have used DRIVE_LAYOUT_INFORMATION_EX now instead aswell
--PerspX
"Nowadays, security guys break the Mac every single day. Every single day, they come out with a total exploit, your machine can be taken over totally. I dare anybody to do that once a month on the Windows machine." - Bill Gates
|
|
|
|
|
Hey Frnds
thanks to giveyour valuable time....
I need some conceptual help.
If i have a rect Object CRect(10,10,1000,1000)
and i frequently chane only (200,200,500,500) region rest remain unchange.
How InvalidateRect is useful? whether it redraw whole CRect(10,10,1000,1000) or just (200,200,500,500) on each OnDraw call..
thnaks
|
|
|
|
|
himuskanhere wrote: How InvalidateRect is useful? whether it redraw whole CRect(10,10,1000,1000) or just (200,200,500,500) on each OnDraw call..
just (200,200,500,500), as stated here [^]:
Before BeginPaint returns the display device context, the system prepares the device context for the specified window. It first sets the clipping region for the device context to be equal to the intersection of the portion of the window that needs updating and the portion that is visible to the user. Only those portions of the window that have changed are redrawn. Attempts to draw outside this region are clipped and do not appear on the screen.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hi,
I am working on propertysheet application wizard, to change my application icon i have change 16x16, 32x32, 48x48 of 256 colors, this is working fine.
when I change my settings(Right Clik on Desktop->properties->settings->color quality) to "Medium(16bit)background becomes block.Can anyone help me for this?
|
|
|
|
|
Hi!
I have a problem in retrieving printer information using FindNextPrinterChangeNotification() function.My code executes properly without any error and exception but all the values in LPPRINTER_NOTIFY_INFO structure are NULL or zero.code as follow
LPPRINTER_NOTIFY_INFO notification;
LPPRINTER_NOTIFY_OPTIONS notifyoption;
notifyoption = (LPPRINTER_NOTIFY_OPTIONS)HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(PRINTER_NOTIFY_OPTIONS) );
notification = (LPPRINTER_NOTIFY_INFO)HeapAlloc ( GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(PRINTER_NOTIFY_INFO) );
OpenPrinter("HP LaserJet 3200 Series PS",&hprinter,NULL);
if(hprinter == INVALID_HANDLE_VALUE)
MessageBox("printer not available","",MB_OK);
hnotify = FindFirstPrinterChangeNotification(hprinter,PRINTER_CHANGE_ALL,0,notifyoption);
notifyoption->Flags = PRINTER_NOTIFY_OPTIONS_REFRESH;
if(hnotify == INVALID_HANDLE_VALUE)
MessageBox("Invalid handle hnotify","",MB_OK);
DWORD retcode = WaitForSingleObject(hnotify,INFINITE);
if(retcode == WAIT_OBJECT_0)
{
BOOL ret = FindNextPrinterChangeNotification(hnotify,&changeNotify,notifyoption,(LPVOID*)notification);
if(ret !=0)
{
if(notification->aData[0].Type == PRINTER_NOTIFY_TYPE)
MessageBox("printer notification","",MB_OK);
sprintf(msg,"Field=%d",notification->aData[0].Field);
MessageBox(msg,"",MB_OK);
if(notification->aData[0].Field == PRINTER_NOTIFY_FIELD_SERVER_NAME)
{
MessageBox("Printer Name is","",MB_OK);
memcpy(printername,(char *)notification->aData[0].NotifyData.Data.pBuf,notification->aData[0].NotifyData.Data.cbBuf);
MessageBox(printername,"",MB_OK);
}
else
MessageBox("other than printer name","",MB_OK);
FreePrinterNotifyInfo(notification);
}
else
MessageBox("error in executing","",MB_OK);
ivalue of Field and cBuf is NULL
please if anyone can identify the problem..it will be very helpful for me
Thnaks in advance
|
|
|
|
|
Could it be because you appear to have not set the Version field of the 2 PRINTER_NOTIFY structures? MSDN recommends setting the Version to 2 see here[^]
|
|
|
|
|
Hi
consider the function
void ClassName::Fun()const
{
//Here we cant change the value of the datamember
}
Is there any benefit of using the const member function.Like Performance benefit.
VIBIN
"Fool's run away,where angle's fear to tread"
|
|
|
|
|
Generally const function are GetXXX methods, which will return only values. It ensures that the data members will not be changed by mistakenly.
Declaring a member function with the const keyword specifies that the function is a "read-only" function that does not modify the object for which it is called.
Regards,
Paresh.
|
|
|
|
|
vibindia wrote: Is there any benefit of using the const member function.Like Performance benefit
The benefit is that the code is more expressive and less error prone. If you pass a const reference to one of these you gaurantee that only const methods can be called through that reference
|
|
|
|
|
Oh, yes.
Suppose you have to pass an object of class A (say a ) to an object of class B (say b ) only to informative purposes, i.e. you don't want b to change a . You may, for instance, pass a itself as const A & this automatically allows b only to call const member functions of a . That is the trick: if A has no const member functions, then the const A & is useless.
Hope that helps.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
::CoInitialize(NULL);
m_rsocp.CreateInstance(__uuidof(Recordset));
m_rsocp->Open((LPCTSTR)str,(LPCTSTR)m_strConnection,adOpenDynamic,adLockOptimistic,adCmdUnknown);
if(FAILED(m_rsocp->QueryInterface(__uuidof(IADORecordBinding),(LPVOID*)&binding)))
_com_issue_error(E_NOINTERFACE);
adoctrl.m_UserId = tempuserid;
adoctrl.m_NewAccount = LArray[0];
adoctrl.m_InactivateAccount = LArray[1];
binding->AddNew(&adoctrl);
binding->Update(&adoctrl);
binding->BindToRecordset(&adoctrl);
m_rsocp->Close();
::CoUninitialize();
|| ART OF LIVING ||
|
|
|
|
|
It has always been my understanding that the definition of the Manifest constant _AFXDLL meant that MSVC be linked by DLL, e.g. through MSVC42.DLL etc. instead of as a static Library. Is this assumption correct?
LateNightsInNewry
|
|
|
|
|
When _AFXDLL is defined, that indicates you will be linking to the DLL version of the MFC
libraries. It needs to be defined before the MFC header files are used so the correct
definitions/declarations/etc. are used to match the DLL build of MFC.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
"Remember the five Ds of dogeball: Dodge, Dip, Duck, Dive, and Dodge."
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
I need the web page to create multi ActiveX control dynamically,how can i do?
Later buggers harm more.
|
|
|
|
|
So I want to have my own modified button class in order to store variables. However, every time I add an array of the buttons, it causes my program to stop responding to keyboard input. Here's the custom Button Class:
public ref class buttonStoleMyInput: System::Windows::Forms::Button
{
void ButtonClick(System::Object^ /*sender*/,System::EventArgs^ /*e*/)
{
this->Toggle ^= true;
}
};
Then, I have a function to initialize an array of 10 buttons. It's called inside the constructor of the main form, and declared further down in the header file. The 10 buttons are stored in a static array.
public ref class Form1 : public System::Windows::Forms::Form
{
static array<buttonstolemyinput^>^ buttons
= gcnew array<buttonstolemyinput^>(10);
public:
Form1(void)
{
InitializeComponent();
AddCustomButtons();
}
//Windows Form Designer Code Follows
//until my AddCustomButtons() function:
private: void AddCustomButtons(void)
{
for(int i = 0; i < 10; i++)
{
buttons[i] = gcnew buttonStoleMyInput(i,0,(i*20));
buttons[i]->Click+= gcnew EventHandler(buttons[i], &buttonStoleMyInput::ButtonClick);
}
this->Controls->AddRange(buttons);
}
Additionally, I have a handler for keyboard input:
private: System::Void Form1_KeyPress(Object^, KeyPressEventArgs^)
{
MessageBox::Show("Keypress Detected");
}
If I uncomment the "AddCustomButtons" function from the Constructor, the program recognizes keyboard input again. If I uncomment it, the program spawns the buttons (and they work), but stops responding to keypresses.
Anyone have any idea whats going on?
|
|
|
|
|
You're posting in the wrong forum. Use the (Managed) C++/CLI[^] forum.
My first thought would be to not use an EventHandler at all. Have you tried overriding OnClick() in buttonStoleMyInput instead?
|
|
|
|
|
Is there a limit on the number of dialog items that can be put on a dialog in a single dialog application? How many edit boxes, buttons, etc?
|
|
|
|
|
I don't think there is a maximum. I would imagine the maximum would be dependent on the screen resolution and how badly you want to overwhelm the user
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
I think the RC file format has a limit of 255 controls. The actual window system has a limit of 10000 USER handles per process.
|
|
|
|
|
Please post a pic of your dialog with 10000 controls on it!
Mark Salsbery
Microsoft MVP - Visual C++
"Remember the five Ds of dogeball: Dodge, Dip, Duck, Dive, and Dodge."
"If you can dodge a wrench, you can dodge a ball."
|
|
|
|
|
I think yes some times ago I add some controls on the forum but then compiler shows a message that you cant insert controls to forum.
|
|
|
|
|