|
Basically two ways to do this that I know of:
1. Make a call from your C code to the Operating System API for shutdown. Which API call, what permissions you need and what options you have depends on the Operating System.
2. Break out the books and learn to make ACPI BIOS calls, probably more assembler than C. This will do it fast and sure but you may corrupt your OS and will certianly loose any unsaved data if you go this way.
"The secret of happiness is freedom, and the secret of freedom, courage."
Thucydides (B.C. 460-400)
|
|
|
|
|
|
Hello Friends
I am going to add Ribbon Toolbar in My Existing MFC application. As i go through on net,i found that in VS2010,we can create Ribbon Resource using Ribbon Designer Inspite of using Ribbon Classes to create Ribbon Toolbar.
Now, I am using VS2010. I want to know How can I Add Ribbon toolbar to my application which is using old toolbars. Do I need to create Ribbon Resource Independently and then to load in Exisitng Application Or Some other Way to DO it?
Any Help Will be Appreciated.I want to in Right way when I update to Ribbon toolbar.
Thanks In Advance.
Regards
Y
|
|
|
|
|
|
Hi,
I have a derived CAsyncSoct class as a member of a Derived CwinThread Class
the members that I have in my derived CAsynSocket class include data members such as a port no
that I wish to connect to
so...
class CSocketThread : public CwinThread
{
public
CSocket thisicket
}
class CSocket : public CAsynSocket
{
I create a UI thread
via new SockThread(start_port)
I create the thread suspended
fill in the missing pieces such the ipaddr, port #
Then do a resumethread this should kick the SockThread:Iinitinstance overridable
I figure by this time everthing the SockThread and Csocket Objects has been Created
So in the SOckThread::initinstance I do a Socket.create withe yhe ipaddr and port
By the time i get to create the third of fourth thread I get an exceptin from
CAsynSocket::Create
One of my questons is if I create the SockThread on the heap via new does that mean
every data memeber and or classes such the CSocket is contructed on the heap
and is there something wrong with my design
Thanks in advance
|
|
|
|
|
First of all, without synchronisation objects, you can't rely on anything having happened in another thread.
Second, CAsynchSocket has some inherent design problems (see CSocket considered harmful). You might want to consider rolling your own using the Win32 SDK if you're going to keep it running in a separate thread.
Third, you shouldn't create your CWinThread object directly. Use AfxBeginThread instead.
|
|
|
|
|
Thank you for response youe point about synchronistion is well taken
Second I am creating a UI thread as I want the send/receive socket to be initiate dvia messages and I dont beleive the owrker threads can process messages
I didn't know there were porblems with CSocket
Thank you
|
|
|
|
|
i used browser control in win32 dialogbox. i want to disable rightclick popup. who can i do that .
|
|
|
|
|
Is it your application wherein you are going to do this, or do you want this to be across the SYSTEM?
You talk about Being HUMAN. I have it in my name
AnsHUMAN
|
|
|
|
|
yes,i have one win32 diallogbox with one browser custum control. i am calling this dialog from dll.it is working fine.i taring to disable right click of web browser control.
|
|
|
|
|
|
Hi,
How can i retain the text color while highlighting a particular row in Clist control
I am using a derived Clist control where already draw item is overridden in the name of OnNMCustomdraw (OnNMCustomdraw(NMHDR *pNMHDR, LRESULT *pResult))
|
|
|
|
|
The colors set in a custom draw handler for CListCtrl s are ignored for selected and hot items. With classic styles, the system uses COLOR_HIGHLIGHTTEXT for selected items. If you want to use other colors for selected and hot items, you must draw the items yourself and set the custom draw handler result to CDRF_SKIPDEFAULT :
void CMyListCtrl::OnCustomDraw(NMHDR* pNMHDR, LRESULT* pResult)
{
*pResult = CDRF_DODEFAULT;
LPNMLVCUSTOMDRAW lplvcd = reinterpret_cast<LPNMLVCUSTOMDRAW>(pNMHDR);
switch (lplvcd->nmcd.dwDrawStage)
{
case CDDS_PREPAINT : *pResult = CDRF_NOTIFYITEMDRAW; break;
case CDDS_ITEMPREPAINT : *pResult = CDRF_NOTIFYSUBITEMDRAW; break;
case CDDS_ITEMPREPAINT | CDDS_SUBITEM : if (IsSelected(lplvcd->nmcd.dwItemSpec))
{
DrawCell(lplvcd, COLOR_HIGHLIGHTTEXT);
*pResult = CDRF_SKIPDEFAULT; }
else
{
}
break;
}
}
This example is for a report style list control.
|
|
|
|
|
how to build application for x86 on visual studio 2003
|
|
|
|
|
As opposed to what? Normally F7 will build whatever application you have created.
Have you tried this forum?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
x86 is usually the default... so just build it and it should work on x86. if you have to do something for x64, then you usually have to use the 64-bit compiler (which is included but not the default).
|
|
|
|
|
Hello Friends
I am trying to connect to USB Printer.For that i m using Setup Calls but SetupDiEnumDeviceInterfaces is returning FALSE . Here is the Code that i m using to get DevicePath:
#define CLSID_STR_WEIUSB (L"{4d36e979-e325-11ce-bfc1-08002be10318}")
int main(int argc, char* argv[])
{
GUID DevClass; HDEVINFO hDevInfoSet; DWORD dwIndex; DWORD dwRequired; DWORD dwError; BOOL bResult;
SP_DEVICE_INTERFACE_DATA DevNode;
PSP_DEVICE_INTERFACE_DETAIL_DATA DevDetails;
CLSIDFromString(CLSID_STR_WEIUSB, &DevClass);
hDevInfoSet = SetupDiGetClassDevs(
&DevClass, NULL, NULL, DIGCF_ALLCLASSES);
if (hDevInfoSet == INVALID_HANDLE_VALUE)
{
fprintf(stderr,
"Unable to create device information set (Error 0x%08X)\n",
GetLastError());
return 1;
}
printf("Successfully created device information set.\n");
for (dwIndex = 0; ; dwIndex++)
{
DevNode.cbSize = sizeof(DevNode);
bResult = SetupDiEnumDeviceInterfaces(
hDevInfoSet, NULL, &DevClass, dwIndex, &DevNode);
if (!bResult)
{
dwError = GetLastError();
if (dwError != ERROR_NO_MORE_ITEMS)
{
fprintf(stderr,
"Error enumerating devices (0x%08X).\n",
dwError);
}
break;
}
SetupDiGetDeviceInterfaceDetail(
hDevInfoSet, &DevNode, NULL, 0, &dwRequired, NULL);
DevDetails = (PSP_DEVICE_INTERFACE_DETAIL_DATA)malloc(dwRequired);
if (DevDetails == NULL)
{
fprintf(stderr,
"Unable to allocate memory for buffer. Stopping.\n");
break;
}
memset(DevDetails, 0, dwRequired);
DevDetails->cbSize = sizeof(SP_DEVICE_INTERFACE_DETAIL_DATA);
bResult = SetupDiGetDeviceInterfaceDetail(
hDevInfoSet, &DevNode, DevDetails, dwRequired, &dwRequired, NULL);
if (!bResult)
{
fprintf(stderr,
"ERROR: Unable to retrieve device path (0x%08X).\n",
GetLastError());
}
else
{
printf(" %s\n", DevDetails->DevicePath);
}
free(DevDetails);
} getchar();
return 0;
}
Class GUID, I extract it manually from registery. After that in fn SetupDiGetClassDevs,I tried DIGCF_ALLCLASSES or DIGCF_DEVICEINTERFACE + DIGCF_PRESENT.
But main prob ,m facing that after When I am calling SetupDiEnumDeviceInterfaces which is returning False.
Any ideas?
Regards
Yogesh
|
|
|
|
|
Hey Guys
I tried by passing
{A5DCBF10-6530-11D2-901F-00C04FB951ED} this GUID and It returns me all USB' devicePath. but how can I differentiate for Printer?
Any Ideas ?
Thanks in Advance.
|
|
|
|
|
There's a call (can't remember off the top of my head) that gives you more descriptive information based on the device ID (which you should be able to extract from the information above).
|
|
|
|
|
Thanks A Lot For Reply.
I got the printer by matching Product Id And Vendor ID.
Y
|
|
|
|
|
I am trying to find Volume control in c/c++/visualc++ for windows7?? Any suggesions please help me.
|
|
|
|
|
Are you both from the same school??
Check the answer here
|
|
|
|
|
In C/C++ on windows vista/7 how to get master volume or how to change master volume programmatically in C++/VC++?
Please give a detailed reply beacuse i am new to VC++
Thanks in advance...
|
|
|
|
|
A simple google search with above question results many samples...
here is the one [^] and the rest[^]
|
|
|
|
|
See here.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|