|
unsigned int it = V_INT(&PhysicalMemoryVal);
Does this actually make sense here or is there some problems with the pointers
We have a mathematician, a different kind of mathematician, and a statistician!
|
|
|
|
|
Interesting.
What is PhysicalMemoryVal? Looks like you are casting its memory address, not what is occupied in memory.
kuphryn
|
|
|
|
|
Thats what I tought, how do I get the proper value please????
Oh by the way PhysicalMemoryVal is the amount of memory the operating system has available, you get it from WMI classes
We have a mathematician, a different kind of mathematician, and a statistician!
|
|
|
|
|
Given that PhysicalMemoryVal is a memory address, one possible solution is pointer.
unsigned int *pValue = PhysicalMemoryVal;
Kuphryn
|
|
|
|
|
no good,
now I get and error
error C2440: 'initializing' : cannot convert from 'INT' to 'unsigned int *'
But I dont understand because I use another function in the same way only it return a 16 bit int and there seems to be no problem there
We have a mathematician, a different kind of mathematician, and a statistician!
|
|
|
|
|
Actually!!!!
how do i declare a 64 bit int????????
uint64?????
We have a mathematician, a different kind of mathematician, and a statistician!
|
|
|
|
|
Check out MSDN.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winprog/winprog/windows_data_types.asp
Check out my website for more links on software development.
http://www.dslextreme.com/users/kuphryn/links.html
Kuphryn
|
|
|
|
|
roadragedave wrote:
how do i declare a 64 bit int????????
__int64
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
What type is PhysicalMemoryVal ? Your code will only work if it is a VARIANT .
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Yes PhysicalMemoryVal is a VARIANT
The value returns something, but its a negative number which doesnt make any sense
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_operatingsystem.asp
at this website you will find a uint64 FreePhysicalMemory
Im trying to plot this against another value uint64 TotalVisableMemorySize
but the values Im getting are way out
My GetProperty method for getting the values works fine, because I have it fetching another value without any problems.
|
|
|
|
|
IWbemClassObject *pClass;
_variant_t v;
HRESULT hr;
hr = pClass->Get(L"FreePhysicalMemory", 0, &v, NULL, NULL);
if (SUCCEEDED(hr) && VT_NULL != v.vt)
TRACE("FreePhysicalMemory = %S KB\n", V_BSTR(&v));
hr = pClass->Get(L"TotalVisibleMemorySize", 0, &v, NULL, NULL);
if (VT_NULL != v.vt)
TRACE("TotalVisibleMemorySize = %S KB\n", V_BSTR(&v));
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
problem:
i need different-shaped buttons to be placed in client area in runtime.
for example:
rightclick in client area opens context menu with options:
round button
triangle button
by clicking on one of the above appropriate button shoud be drawn in client area. this button (like all others created this way) should have all standard properties of a button (CButton)
my experiment:
i've tried with SetWindowRgn but id doesn't work
then i used "common" CreateWindow with BUTTON as parametar and got a nice round button but my program wouldn't accept any further rightclicks (no context menu)
this is my method wich creates squared flat button
(i could create many buttons)
void CpaintView::OnFalseCircle()
{
CPoint point;
GetCursorPos(&point);
ScreenToClient(&point);
CButton *cir = new CButton();
cir->Create("tri",BS_FLAT, CRect(point,CPoint
(point.x+20,point.y+20)),AfxGetMainWnd(),1);
cir->ShowWindow(SW_SHOWNORMAL);
}
and non-working method wich creates one circle and stucks
void CpaintView::OnCircle()
{
CPoint point;
GetCursorPos(&point);
ScreenToClient(&point);
CRect rect(point, CPoint(point.x+50, point.y+50));
CRgn rgn;
Circle *cr = new Circle();
rgn.CreateEllipticRgnIndirect(rect);
SetWindowRgn(rgn,true);
CreateWindow("BUTTON","",WS_CHILD | WS_VISIBLE, point.x-10,point.y- 10,70, 70, *this,(HMENU)101,0,0);
}
thanks
|
|
|
|
|
I am having difficulty with the Microsoft NTFS DACL calls, specifically GetNamedSecurityInfo and GetExplicitEntriesFromAcl. I am using VC++ version 6. I have searched the internet thoroughly, and have found several examples of using GetNamedSecurityInfo but haven't found any examples of how to us GetExplicitEntriesFromAcl. My code seems to get the DACL from GetNamedSecurityInfo okay, but I don't now how to get the individual entries from the pointer to an array of DACLs from the GetExplicitEntriesFromAcl function. I need to roll my own "get NTFS permissions" function to include in other C++ programs. I am just getting up to speed on C++, and need a little tutoring on pointers and pointers to arrays. I believe that GetExplicitEntriesFromAcl returns a pointer to an array of DACLs, as well as the number of DACL entries. An example of how to extract the DACL entries from the pointer information would be appreciated.
|
|
|
|
|
The following code was found in none of the Codeguru thread.
This code is written in c++ and console application and my application is .Net dialog based application.
Could you please help me how to convert the following code to c++.Net . ?????????????????????
<br />
#include <windows.h><br />
<br />
#define DIVISIONS 5<br />
<br />
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;<br />
<br />
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,<br />
PSTR szCmdLine, int iCmdShow)<br />
{<br />
static TCHAR szAppName[] = TEXT ("Checker2") ;<br />
HWND hwnd ;<br />
MSG msg ;<br />
WNDCLASS wndclass ;<br />
<br />
wndclass.style = CS_HREDRAW | CS_VREDRAW ;<br />
wndclass.lpfnWndProc = WndProc ;<br />
wndclass.cbClsExtra = 0 ;<br />
wndclass.cbWndExtra = 0 ;<br />
wndclass.hInstance = hInstance ;<br />
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;<br />
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;<br />
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;<br />
wndclass.lpszMenuName = NULL ;<br />
wndclass.lpszClassName = szAppName ;<br />
<br />
if (!RegisterClass (&wndclass))<br />
{<br />
MessageBox (NULL, TEXT ("Program requires Windows NT!"), <br />
szAppName, MB_ICONERROR) ;<br />
return 0 ;<br />
}<br />
<br />
hwnd = CreateWindow (szAppName, TEXT ("Checker2 Mouse Hit-Test Demo"),<br />
WS_OVERLAPPEDWINDOW,<br />
CW_USEDEFAULT, CW_USEDEFAULT,<br />
CW_USEDEFAULT, CW_USEDEFAULT,<br />
NULL, NULL, hInstance, NULL) ;<br />
<br />
ShowWindow (hwnd, iCmdShow) ;<br />
UpdateWindow (hwnd) ;<br />
<br />
while (GetMessage (&msg, NULL, 0, 0))<br />
{<br />
TranslateMessage (&msg) ;<br />
DispatchMessage (&msg) ;<br />
}<br />
return msg.wParam ;<br />
}<br />
<br />
<br />
|
|
|
|
|
The following code was found in none of the Codeguru thread.
This code is written in c++ and console application and my application is .Net dialog based application.
Could you please help me how to convert the following code to c++.Net . ?????????????????????
[code]
#include <windows.h>
#define DIVISIONS 5
LRESULT CALLBACK WndProc (HWND, UINT, WPARAM, LPARAM) ;
int WINAPI WinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
PSTR szCmdLine, int iCmdShow)
{
static TCHAR szAppName[] = TEXT ("Checker2") ;
HWND hwnd ;
MSG msg ;
WNDCLASS wndclass ;
wndclass.style = CS_HREDRAW | CS_VREDRAW ;
wndclass.lpfnWndProc = WndProc ;
wndclass.cbClsExtra = 0 ;
wndclass.cbWndExtra = 0 ;
wndclass.hInstance = hInstance ;
wndclass.hIcon = LoadIcon (NULL, IDI_APPLICATION) ;
wndclass.hCursor = LoadCursor (NULL, IDC_ARROW) ;
wndclass.hbrBackground = (HBRUSH) GetStockObject (WHITE_BRUSH) ;
wndclass.lpszMenuName = NULL ;
wndclass.lpszClassName = szAppName ;
if (!RegisterClass (&wndclass))
{
MessageBox (NULL, TEXT ("Program requires Windows NT!"),
szAppName, MB_ICONERROR) ;
return 0 ;
}
hwnd = CreateWindow (szAppName, TEXT ("Checker2 Mouse Hit-Test Demo"),
WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT, CW_USEDEFAULT,
CW_USEDEFAULT, CW_USEDEFAULT,
NULL, NULL, hInstance, NULL) ;
ShowWindow (hwnd, iCmdShow) ;
UpdateWindow (hwnd) ;
while (GetMessage (&msg, NULL, 0, 0))
{
TranslateMessage (&msg) ;
DispatchMessage (&msg) ;
}
return msg.wParam ;
}
[/code]
|
|
|
|
|
Anonymous wrote:
This code is written in c++...
Actually, it's just plain C code, using the Windows SDK. I've yet to use anything .Net, but plenty of folks here do. Perhaps this forum could also help.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Thank you David. I'll post my message over there and see who can help me.
Thank you again.
|
|
|
|
|
Friends,
Can anyone write me a small program in Vc++ to trap a keyboard event and focus it to a desired window, say ms word.
|
|
|
|
|
Check out SetWindowsHookEx(WH_KEYBOARD, ...) . Once you have that working, then we can focus on sending messages to other applications.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I have a plan to develop a Network Application. Suppose I have a class CServerData with a member function likes: CString CServerData::GetString()
Here is a pseudo implementation of GetString
function:<br />
CString CServerData::GetString(){<br />
1. Connect to Server<br />
2. Send a request to Server<br />
3. Wait until server answer<br />
4. Return a CString<br />
}<br />
So that, in anywhere, I can write:
<br />
CServerData server;<br />
CString st=server.GetString();<br />
If I use CSocket, How can I implement that?
It is better if you can give me a detail example.
Thanks for reading.
|
|
|
|
|
Why reinvent the wheel? How about just using NetServerGetInfo(..., 101, ...) ?
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
For the most part, I work in a bubble and can usually work things out over time. However...
I have a Client/Server application using DCOM where I would like a client to signal the server that it is done with certain operations and now notify all other clients of changes and updates. The notification message is short - a Client ID and a BSTR (< 255 characters) and the client's response is typically short, quickly returning an HRESULT to the server. I am able to make "Connection Points" work fine for two or three clients. When more clients are connected though, things bog down.
Correct me if I am wrong, but COM is sychronus which means that all clients must be notified via a Fire_XXX function before returning to the originating client. This turns out to be well over a minute in some cases! Users believe the program has locked up and take matters into their own hands (torches, clubs, pitch forks - storm the castle).
I have setup the notification method on the server side to bracket the call to the Fire_XXX function in a secondary thread allowing quick return to the client requesting notification. This works much better, but I am unsure if this is the best approach.
I have being trying to find information on "Loosely Coupled Events" without much success. Any guidance or suggestions would be greatly appreciated.
Ross
Ross White
|
|
|
|
|
Greeting, we are college students from Taiwan, here have some problem and wish to get help here, thank you for your reading and answer.
We wish to create a human-face image on PDA, and now we separate the face into some individually images, like hair, eyes, nose and mouth...
Our goal is to treat all the individually images as particular objects, and could drag them into a main working space (a larger image place), then could save them into a single image files.
1. How to control the object with the code that could move and transform the object feely?
2. How should we design the program to let the user could draw and to alter the images like in painter?
3. Would anybody please tell us where could we inquire about the information about GPRS upload program?
The program coder we use is EVB; we sincerely wish you could help us.
|
|
|
|
|
i want to find a library about wav convert to midi(language : c++)for windows 2000.
|
|
|
|
|
learn the theory about sound storage then you will see how silly your question is!
Don't try it, just do it!
|
|
|
|
|