|
I want to write wmi program using vc++(win32).Beacause c++.net or c# does not run on win98.How can i do this?Can u give some examples?
Please help me...
A lot of thanx...
|
|
|
|
|
I think you will probably need to implement use the IWbemLocator, IWbemServices and IWbemObjectSink interfaces. What are you trying to achieve?
Systems AXIS Ltd - Software for Business ...
|
|
|
|
|
I am trying to get system information of a local computer.But i new in win32.
Thanx
|
|
|
|
|
|
Hi all,
I recently was helped out here and given a pointer to use Createfile/Readfile/Writefile for my direct disk access in a bit of code I'm working on...
Unfortunately, while it seems fairly straightforward, I'm having a few difficulties.
The following is my code (with all error checking and other superfluous bits removed, just for clarity - but they are really there!).
I can't for the life of me figure out why this doesn't work. It should simply:
1 - Open the A drive for reading (this does seem to happen)
2 - Open c:\file.img for writing (this does seem to happen)
3 - Read 256bytes from the A drive in to a buffer (actually only doing 256bytes during testing... what I really want it to do is get the size of the disk using GetDiskFreeSpaceEx, then use that as the size to read/write so it does the whole disk)
4 - Write these 256bytes back to c:\file.img
What ends up happening is that I get 256bytes of what appears to be random garbage written in to the file... so it's writing, but WHAT it's writing and where it's getting it from I have no idea...
It's likely the problem lies in a fundamental failure to understand how this process is supposed to work. Therefore, this is probably something insanely simple and I'm going to feel like a complete moron, but as a relative beginner in C++ (despite the scary concept that I now do it "officially" for work) I think I'm entitled to be a moron on rare occasions
<br />
HANDLE hDriveRead;<br />
hDriveRead = CreateFile(TEXT("\\\\.\\a:"), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);<br />
<br />
HANDLE hFileWrite;<br />
<br />
hFileWrite = CreateFile(TEXT("c:\\file.img"), GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);<br />
<br />
DWORD dwImageBuffer[256];<br />
DWORD nBytesToCopy=256;<br />
DWORD nBytesRead;<br />
DWORD nBytesWritten;<br />
ReadFile(hDriveRead, dwImageBuffer, nBytesToCopy, &nBytesRead, NULL);<br />
WriteFile(hFileWrite, dwImageBuffer, nBytesToCopy, &nBytesWritten, NULL);<br />
<br />
CloseHandle(hFileWrite);<br />
CloseHandle(hDriveRead);<br />
Any help would be greatly appreciated.
|
|
|
|
|
YttriumOxide wrote:
What ends up happening is that I get 256bytes of what appears to be random garbage written in to the file
What are you expecting to see in the image file? The first sector (512 bytes) of the disk is the boot sector, which has mostly machine language code.
--Mike--
LINKS~! Ericahist updated! | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
I'm aware of that... but what I'm getting really is garbage - not the first 256bytes of the disk (which as you quite rightly point out is the first 256bytes of the bootsector).
|
|
|
|
|
Hi,
I've subclassed CComboBox. I've setup the background and text colours called Invalidate(). Which works perfectly well with the edit box. It's when I dropdown it's crashing the app. I want to able to change the colour of the listbox part as well.
Here's the code snippet:
<br />
BEGIN_MESSAGE_MAP(CComboEx, CComboBox)<br />
ON_WM_CTLCOLOR_REFLECT()<br />
ON_WM_CTLCOLOR()<br />
END_MESSAGE_MAP()<br />
<br />
<br />
HBRUSH CComboEx::CtlColor(CDC* pDC, UINT nCtlColor) <br />
{<br />
<br />
<br />
pDC->SetTextColor(m_Text);<br />
pDC->SetBkColor(m_Background);<br />
pDC->SetBkMode(TRANSPARENT);<br />
m_brush.DeleteObject();<br />
m_brush.CreateSolidBrush(m_Background);<br />
return m_brush;<br />
}<br />
<br />
HBRUSH CComboEx::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor) <br />
{<br />
HBRUSH hbr = CComboBox::OnCtlColor(pDC, pWnd, nCtlColor);<br />
<br />
return hbr;<br />
}<br />
<br />
Thanks in advance,
Alton
|
|
|
|
|
I need some help with the function CRecentFileList::GetDisplayName.
How did I get the full Path back from this function?
Although the full Path is stored in the Registry I always retrieve the shortened Path like
"D:\MyProgramm\DirLevel1\...\DirLevel4".
Could someone give me a hint on that please?
Thanks
|
|
|
|
|
|
Thanks ravi.
That was a really good hint.
Now I use
csDir = (*m_pRecentFileList)[nMRUIndex];
instead of my first try
m_pRecentFileList->GetDisplayName(csDir,nMRUIndex,"",0,true);
and it works fine.
|
|
|
|
|
By now I can generate some dib bitmap in a MDI application dynamic, so there are many bitmap in a view.In one hand,I need to manipulate these bitmap by the mouse, for example, drag a bitmap to somewhere else, or enlarge a bitmap by drag a bitmap's edge and so on.Another hand, I also need to manipulate these bitmap in while,such as printing the whole view.
What should do?
I think I need define a new view class or control which can contain and display one bitmap.then I only need the manipulate the view class or control.
andy
|
|
|
|
|
|
thank you, Selvam.
andy
|
|
|
|
|
How do I make my dialog box initially visible with MFC?
|
|
|
|
|
say detailedly .
CDialog dlg;
dlg.DoModal() ??
|
|
|
|
|
I had tried that. Actually I want to use the dialog box as a toolbar, that is why i want it visible. I have .cpp and .h files for the toolbar class derived from CDialog. I included the .h file in MainFrm.cpp. I also have CToolBarNew m_wndToolBarNew; in the protected section ofCMainFrame class. But it still gives compiler error: missing storage-class or type specifiers
|
|
|
|
|
Kapgan wrote:
I included the .h file in MainFrm.cpp.
Put it in the MainFrm.h file.
Why aren't you extending CToolBar?
ed
~"Watch your thoughts; they become your words. Watch your words they become your actions.
Watch your actions; they become your habits. Watch your habits; they become your character.
Watch your character; it becomes your destiny."
- -Uknown.
|
|
|
|
|
What is the simplest way to create a socket for UDP transfer
|
|
|
|
|
The "simplest" way is to search codeproject instead of asking here!
Don't try it, just do it!
|
|
|
|
|
How to implement the concept of Media Gateways in VoIP.
What are the values for parameters of the socket() function in VC++ to send RTP datagrams.
|
|
|
|
|
Hi all,
I am currently evaluating SSL components from IPWorks to
implement https protocol for client-server communication.
But it is a bit expensive, do anyone have any experience on using it
or are there any other cheaper component for SSL communication ?
Thanks
|
|
|
|
|
Check out OpenSSL.
Kuphryn
|
|
|
|
|
MS XML Core[^]
ed
~"Watch your thoughts; they become your words. Watch your words they become your actions.
Watch your actions; they become your habits. Watch your habits; they become your character.
Watch your character; it becomes your destiny."
- -Uknown.
|
|
|
|
|
I was wondering if any has info on the undocumented menu control messages, similar to the button messages: BM_CLICK, etc.
I found a really simple way to subclass the menu by changing its windows-class wnd proc.
First create an invisible menu window with the class name of "#32768" called from the CMainFrame's OnCreate, using it as a parent:
hwnd = CreateWindow( "#32768", "", WS_CHILD, 0,0,10,10,
pParent->m_hWnd, (HMENU) 0, AfxGetInstanceHandle(), &cs );
Then replace the window-class wnd proc with your own:
s_OldWindowProc = (WNDPROC) SetClassLong( hwnd,
GCL_WNDPROC, (DWORD) WindowProc );
Then destroy the window because you don't need it anymore - all menus in your app have the same class wnd proc.
In your "WindowProc" you send all the messages to the orginal class proc using CallWindowProc().
Here are the messages and what they seem to do:
0x000001E5: -Draw mouseover item and send statusbar msg.
0x000001EF: -Send out the command msg
0x000001E4: -End of popup menu
0x000001ED: -Process lbuttondown, draw pressed item, send statusbar msg
0x000001EB: -Handles when to send the command and terminate the popup
Now I think I have enough to override all the drawing so I can replace it with my own, while maintaining full menu functionality, even though I have to use LockWindowsUpdate() to prevent drawing on 0x01E5 and 0x01ED, while calling the orginal proc.
But it would be great to get the message names and the info they have in the Params, which would make skinning the menus a lot easier. Any help or info on where I can this information would be greatly appreciated.
BTW, thanks to .dan.g. and his orignal article on the subject for a lot of the information: http://www.codeproject.com/menu/skinmenu.asp
|
|
|
|