Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
R

roadragedave

@roadragedave
About
Posts
36
Topics
13
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • casting problems for int
    R roadragedave

    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.

    C / C++ / MFC

  • casting problems for int
    R roadragedave

    Actually!!!! how do i declare a 64 bit int???????? uint64????? We have a mathematician, a different kind of mathematician, and a statistician!

    C / C++ / MFC

  • casting problems for int
    R roadragedave

    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!

    C / C++ / MFC

  • casting problems for int
    R roadragedave

    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!

    C / C++ / MFC

  • casting problems for int
    R roadragedave

    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!

    C / C++ / MFC

  • Passing classes into threads
    R roadragedave

    No good, First I think the WmiWrapper* is 64 bits, where as DWORD is 32, so this gives me data loss warnings, Also the parameter is LPTHREAD_START_ROUTINE, not DWORD, so this gives me an error. Its alright because I have it fixed (see David Crows code above), but now Im getting a memory voilation when running, and its in one of the classes methods, I dont understand, because I was running the program without threads before and I didnt get this problem, I thought mabey it has something to do with the fact that Im creating two threads which pass the same object, but if I turn off one I still get the error:confused: We have a mathematician, a different kind of mathematician, and a statistician!

    C / C++ / MFC question

  • Passing classes into threads
    R roadragedave

    Fantastic!!!! We have a mathematician, a different kind of mathematician, and a statistician!

    C / C++ / MFC question

  • Passing classes into threads
    R roadragedave

    But how, by using this: DWORD WINAPI loadPerThrdFunc( LPVOID param ) { DWORD *p = (DWORD *) param; TCHAR s[32]; wsprintf(s, "The thread value is %lu\n", *p) MessageBox(s); } can I get to call the methods of the WmiWrapper class Wmi Im calling the CreateThread method like so: DWORD loadPerThrd = CreateThread( NULL, 0, loadPerThrdFunc, &dwThrdParam, 0, &loadPerThrdID); We have a mathematician, a different kind of mathematician, and a statistician!

    C / C++ / MFC question

  • Passing classes into threads
    R roadragedave

    Excellent stuff, that got rid of the warning, but again how, do I change it back inside the thread function We have a mathematician, a different kind of mathematician, and a statistician!

    C / C++ / MFC question

  • Passing classes into threads
    R roadragedave

    Im still lost, You said that pointers and DWORD are 32 bits, but when I build the app, the following line warnss me that there is a possible mismatch DWORD dwThrdParam = UINT_PTR(&Wmi); gives me: warning C4244: 'initializing' : conversion from '__**w64** unsigned int' to 'DWORD', possible loss of data but otherwise it passes fine, but how do I turn the parameter LPVOID param back into the object or at least a pointer to the object???? We have a mathematician, a different kind of mathematician, and a statistician!

    C / C++ / MFC question

  • Passing classes into threads
    R roadragedave

    Im creating threads and I want to pass a pointer to the threads, Is is possible to cast a pointer to a class into a DWORD, if so, how is it done??? Here is the code Im working with, its taken straight from the MSDN void main(void){ DWORD loadPerThrdID; HANDLE loadPerThrd; TCHAR szMsg[80]; DWORD dwThrdParam; static WmiWrapper Wmi(NULL, NULL, NULL); //Creating object loadPerThrd = CreateThread( NULL, 0, loadPerThrdFunc, &dwThrdParam, 0, &loadPerThrdID); if(loadPerThrd == NULL){ wsprintf(szMsg, (TEXT("Create Thread failed for LoadPercentage"))); MessageBox(NULL, szMsg, NULL, MB_OK); } else{ _getch(); CloseHandle(loadPerThrd); } } //Threads function DWORD WINAPI loadPerThrdFunc (WmiWrapper Wmi) { ................ } What can I do to get this to work, or am I completly out??????

    C / C++ / MFC question

  • JNI
    R roadragedave

    Im using a Java dialog to call a C++ app using JNI, All I want to do is pass an object into the cpp app, there is no writing to be done to the object, just passing strings and bool values. How do I change my main() in cpp to be able to accept this object and be able to compile it into a .dll Any articles or help is appreciated. Cheers We have a mathematician, a different kind of mathematician, and a statistician!

    C / C++ / MFC c++ java help question

  • JNI
    R roadragedave

    Im using a Java dialog to call a C++ app using JNI, All I want to do is pass an object into the cpp app, there is no writing to be done in the class, just passing strings and bool values. How do I change my main() in cpp to be able to accept this object and be able to compile it into a .dll Any articles or help is appreciated. Cheers We have a mathematician, a different kind of mathematician, and a statistician!

    C / C++ / MFC c++ java help question

  • Files & strings
    R roadragedave

    No!, what i want is the graph to increment indefinatly every second, so when x reaches 20 then the lower and upper bound of the x-axis on the graph will increment, in other words the x-axis will show from 1-21, then 2-22, 3-23, and so on. We have a mathematician, a different kind of mathematician, and a statistician!

    C / C++ / MFC data-structures help

  • Files & strings
    R roadragedave

    Your right, I just set a large buffer for s and it worked char s[1024] = {0}; Thanks v.m. We have a mathematician, a different kind of mathematician, and a statistician!

    C / C++ / MFC data-structures help

  • Files & strings
    R roadragedave

    Excellent, that worked a charm, Thanks! We have a mathematician, a different kind of mathematician, and a statistician!

    C / C++ / MFC data-structures help

  • Files & strings
    R roadragedave

    I am working on a project where Im reading values from a machine every second, I then increment these values in a file, and then graph this file, every second I reset the plot and graph it again with the new values, when I reach the end of the upper bound of the x-axis, I want the lower and upper bounds to increment by 1 every second, Im working inside a forever loop and the code looks like so: x=0; y=0; char* s; for( ;; ) //Get value and write to file. g1.plot_dataFile("data.dat", "test"); Sleep(1000); g1.reset_plot(); x++; if(x>20) //20 is the upper bound of the x-axis { y++; sprintf(s, "set xrange [%i:20+%i]", y, y); g1.cmd(s); } } g1.cmd(string s) is a function to send commands to an external plotting application, and needs to take strings While running, when x reaches 20, I get "Run-Time Check Failure #3 The variable 's' is being used without being defined." Any help please!!! We have a mathematician, a different kind of mathematician, and a statistician!

    C / C++ / MFC data-structures help

  • iostream.h/fstream.h???
    R roadragedave

    Why is iostream.h & fstream.h missing from VC++.NET include folders. If I copy the same files from VC6.0 then I get errors in those files. What can I do, where can I get those header files and if not what headers can I use instead of fstream.h We have a mathematician, a different kind of mathematician, and a statistician!

    C / C++ / MFC csharp c++ question

  • ActiveX Control
    R roadragedave

    I am using VC.NET so I presume that PasswordChar in the Appearence tab is the same thing. Cheers. We have a mathematician, a different kind of mathematician, and a statistician!

    C / C++ / MFC com

  • wprintf problem
    R roadragedave

    I get what you mean, however the function that gets vVal passes it back as uint16, VARIANT, I presume, is a generic data type that holds almost all simple data types and what is needed it to convert to say string, double, BSTR. Using %s threw and exception and I could not figure out using the debuging what exactly was going wrong, I took a chance and changed it to %i, and the application works.:confused: We have a mathematician, a different kind of mathematician, and a statistician!

    C / C++ / MFC help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups