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
M

malaugh

@malaugh
About
Posts
37
Topics
3
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How can read a unicode text file as character by character?
    M malaugh

    If you have the program set to unicode, you need to use _wfopen_s to open the file, and the filename (OpenFile) needs to be specified as wchar_t something like wchar_t Myfile[] = "my_file.ext"; Then you should be able to use fgetwc to get the characters using ch = fgetwc( stream ); your should specify ch as wchar_t

    C / C++ / MFC question

  • Displaying Chinese Characters
    M malaugh

    The easiest way to handle this is to change the font to Aerial Unicode MS. This font is installed n all machines that have office or some office app, like Excel or Word. Its not a Guarantee for all machines. For the other you need to install some other Unicode font. You can do this by Changing the font properties on the main dialog box.

    C / C++ / MFC question

  • Error message running exe
    M malaugh

    Your need to install the Microsoft run-time libraries on the new machine. The libary pack you need depends on your version of Visual Studio, for example, VS2005 needs the following to be installed. http://www.microsoft.com/downloads/en/details.aspx?FamilyID=32bc1bee-a3f9-4c13-9c99-220b62a191ee&displaylang=en Alternatively, you can compile the executable to use static libraries. Open Project->Properties, and select "use MFC in a static library" under General->Use of MFC, then go to Linker->General, go to "Delay Loaded DLLS" and uncheck the "inherit from parent" checkbox.

    C / C++ / MFC help question workspace

  • Write a function to cause a thread to wait
    M malaugh

    All the CPU cycles are going to reaing the clock over and over. If you want to be independant of windows, the function uSleep is Unix the equivelent of Sleep, just add #ifndef WIN32 #define Sleep(x) uSleep(x * 1000) #endif To the top of your code

    C / C++ / MFC help

  • making ini file in Documents and Settings WritePrivateProfileString to
    M malaugh

    I am trying to make an INI file in C:\Documents and Settings\All Users\Application Data\MyApp I know WritePrivateProfileString will write a new file if one does not exist, but if I try

    #define INI_FILENAME "C:\\Documents and Settings\\All Users\\Application Data\\MyApp\\MyApp.ini"

    WritePrivateProfileString("My Section", "My Name", "My Value", INI_FILENAME);

    It will only make a new ini file if the directory exists. Is there a workaround for this? If not, how do I check to see if a directory exists, and make a new one?

    C / C++ / MFC question

  • Schedule events in C
    M malaugh

    You mean code to create a thread? just use DownlinkThread = CreateThread( NULL, // default security attributes 0, // use default stack size Func, // thread function 0, // argument to thread function 0, // use default creation flags &MsgThreadId); // thread identifier The thread function is WORD WINAPI Func( LPVOID lpParam ) { while(1) { Sleep(30 * 60 * 1000); } return(0); } Substitute CreateThread with pthread_create and Sleep with uSleep for the Linux version

    C / C++ / MFC sysadmin linux help tutorial

  • Application upgrade
    M malaugh

    Should be no problem at all. I write MFC applications and have both VS 6.0 and VS 2008 installed on my XP computer. If I open a 6.0 project with VS 2008, it gets automatically converted to the new project format.

    C / C++ / MFC csharp visual-studio question announcement workspace

  • Someone Please Help (WinPCap/TCP Capture)
    M malaugh

    Did you look at this? It worked for me. http://www.tcpdump.org/pcap.htm[^]

    C / C++ / MFC help algorithms

  • Native c++ using VC++ 8.0
    M malaugh

    I had the saem problem as you. I could not get my programs tio run on a machine with just the OS. Now I 1) Change the Project defaults in the General Section to "Use MFC in a static library" 2) Uncheck "Inherit from Parent or project defaults" in the linker Additional Library Directories section (gets rid of a warning). All my programs work on a machone with a "virgin" OS after these changes.

    C / C++ / MFC c++ csharp dotnet help question

  • Dll and global variables.
    M malaugh

    There may be a easier way to do this, but one way is to create global shared memory is to use CreateFileMapping on one DLL, and OpenFileMapping in the other. Pseudo-code is something like: DLL #1 ------ int *pMemory; hMem = CreateFileMapping(....."MySharedMemory"); pMemory = (int *)MapViewOfFile(hMem); pMemory = 3; DLL #2 ------- int *pMemory; int Value; hMem = OpenFileMapping(....."MySharedMemory"); pMemory = (int *)MapViewOfFile(hMem); Value = *pMemory; Note sure if this is 100% correct, its been a while since I used it. grep in codeproject for "Shared Memory with IPC with threads" to get more details.

    C / C++ / MFC question c++ json

  • Opening terminal windows from command line app
    M malaugh

    My mistake, I must have coded it wrong the first time. I tried it again using: ShellExecute(0,0,"myprogram.exe",0,0,SW_SHOWNORMAL); and it worked. I sued a more complex example last time, must be something to do with the options.

    C / C++ / MFC help question

  • Opening terminal windows from command line app
    M malaugh

    Thanks. FYI I found another method. If you open a cmd window and type "start myprogram.exe", the program will start in another window, so in my program I used: system("start myprogram.exe"); I will your method also and see which works best.

    C / C++ / MFC help question

  • taylor formula
    M malaugh

    I cannot guarenee its right, you will have to debug it yourself, but something to get you started #include int main(void) { double current = 1; double old = 0; int n = 1; int factorial = 1; while(fabs(current - old) > 0.05/100) { old = current; factorial *= ++n; current = pow(old, n) / factorial; } }

    C / C++ / MFC c++ help

  • Mapping the Windows XP APIs to Linux
    M malaugh

    For mapping windows threads to linux, take a look at this article http://www.ibm.com/developerworks/linux/library/l-ipc2lin1.html[^ For GUI, I wrote an article on using GTK on Linux and Windows, search for GTK in codeproject and you should find it.

    C / C++ / MFC tutorial linux json help question

  • Opening terminal windows from command line app
    M malaugh

    I need to command line program that starts other command line applications in their own window. I can use spawn or ecec to run the programs but they run in the main window, not their own. I tried using ShellExecute, but I got a linker error. Does a DOS terminal window have a program name I can call using system or spawn? Any suggestions? Thanks

    C / C++ / MFC help question

  • Can I change the priority of "main"
    M malaugh

    I have a main program that creates some threads, then goes into an event loop. The structure is: main() { CreateThread.... CreateThread..... while(1) { WaitForSingleObject(Main_Event) .... do some processing.... } } I would like to increase the priority of "main" so that when "Main_Event" is sent, the threads suspend while main loop is processing. Any idea how I can do this?

    C / C++ / MFC question

  • can i create a dll, what includes other dlls?
    M malaugh

    If you do not want to use "loadlibrary" see other reply) 1) You cannot set a path for a DLL, you must either have your new DLL in the same directory as the DLL you are calling, or put it in the windows/system32 directory. 2) You need to link the lib file. Either add the lib file using project properties or add following to your source file #pragma comment(lib,"DllName.lib") 3) Add the header file for the DLL to your source file.

    C / C++ / MFC question help

  • Catching Key Event of an Edit Box
    M malaugh

    Not sure if this helps but you need to use this code to get return keys in your derived class. Maybe the same for your probem? UINT CEdit_xx::OnGetDlgCode() { return( CEdit::OnGetDlgCode() | DLGC_WANTALLKEYS ); }

    C / C++ / MFC question

  • Windos/Cygwin
    M malaugh

    You could try compiling under windows, just select WIN32 Console application, add all your c files to the project, and compile. It may work of the program has no unix specific calls. If not, you need to install the GCC compiler. Google cygwin to get the files.

    C / C++ / MFC tutorial question

  • help with arrays
    M malaugh

    you need to replace the line test_score[i][j] = 0; with a formula that will give the chart in the answer for example test_score[i][j] = i + j; would give 0 1 2 3 1 2 3 4 2 3 4 5 3 4 5 6 think about it.

    C / C++ / MFC regex help tutorial
  • Login

  • Don't have an account? Register

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