• Welcome to Valhalla Legends Archive.
 
Menu

Show posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Show posts Menu

Messages - iNsaNe

#1
I have a program where the user can copy text to the clipboard by clicking a drop down menu item.

My question is, does a call to EmptyClipboard free the data previously allocated with the call to GlobalAlloc? Or do i need to free the data with GlobalFree? I dont want to create memory leaks.

this is my code


        ...
BYTE size = strPath.size() + 1;
char *pText = (char *)GlobalAlloc(GMEM_FIXED, size);

strcpy(pText, strPath.c_str());
OpenClipboard(hWnd);
EmptyClipboard();
SetClipboardData(CF_TEXT, pText);
CloseClipboard();
        ...
#2
C/C++ Programming / Installing GTK+
September 23, 2009, 03:01 AM
I'm not an advanced GUI designer in C++ and recently discovered GTK+. I'd like to design my programs with that toolkit but I don't know how to install it.

I put all the include and library files into their directories which i thought would be sufficient to get a test program up and running (just #include <gtk/gtk.h>) but apprentyly it isn't.

I've browsed all over the internet for beginner tutorials (that actually make sense to beginners) but have come up with no luck.

Any help would be greatly appreciated.

I use Windows.
#3
I know this might come off as malicious, but how can I create a bot that will log into the general forums?
#4
C/C++ Programming / Re: Process memory C++
July 17, 2009, 12:38 AM
Nvm mark this as solved. I researched and used _CrtDumpMemoryLeaks and it showed me I did have memory leaks. The problem was because I never called ~vector().
#5
C/C++ Programming / Process memory C++
July 16, 2009, 08:39 PM
I have a program that when a button is clicked, an open file dialog appears (with multiselect).
When the user selects all their desired files, the file name of each file becomes the text of a new tab page. My program then stores that data from each file (fread) into its own separate buffer. When the user clicks the button again and selects different files, all the data that was stored before is then freed from memory and the new data is stored into the buffers.

My program usually has a memory usage of 6K,  and of course when they select more files the larger that usage becomes.

My question is, whenever the memory is freed, the program never drops back to what it was normally at (6K). It gradually grows.

Is this a sign of a memory leak? I have made sure that every new matches a delete.
#6
Nevermind, I solved it and it was really simple. I had to make a delegate function to setting the value of the progress bar and giving it an UnmanagedFunctionPointerAttribute and then had to pass it to C++.
#7
C/C++ Programming / C++ 6 and C# window controls
April 12, 2009, 11:35 PM
I've been messing around with mixing unmanaged and managed code recently. I was wondering is it possible to affect a window control in C# through unmanaged code just by passing the control handle?

For example, i'm reading through a file in C++ and I have a progress bar I created in C#. I passed the window handle of the progress bar (ProgressBar.Handle) into C++ and tried using SendMessage to show the progress bar stepping but no luck.
#8
.NET Platform / C++ 2008 Native Coding Bugs?
April 12, 2009, 10:35 PM
So recently I've been making a program that is just for the benefit of my knowledge: how to incorporate unmanaged code with managed code. I've been using C# and C++ 6. When I was finished writing and debugging my code, the program worked perfect.

From there I decided to copy over the code from C++ 6 to C++ 2008 just to see which I liked better. Of course, there were minor errors in the code that I had to make because of the two different compilers but I kept the code exactly the same. When I ran the program again I got a bunch of runtime errors, especially with vectors and protected memory.

Any explanation?



ugh. wrong forum.
#9
haha after reading what i first posted i now realize how extremely vague i was in asking the question.

by replay program i meant warcraft III. i consider this whole forum a Battle.net forum. sorry  :P

I solved it. I've already managed to extract player names out of it.. Ive decided to use SharpZipLib instead of ZLIB, I think it's much easier to use... I figured out how to decompress data in 10 minutes, and haven't been able to figure out ZLIB for days (maybe im stupid)

#10
Hey guys I'm trying to make a replay program, I'm just getting started. I've been able to locate the blocks of data but I don't know how to decompress them. I'm using C# and zlib.net

http://www.componentace.com/zlib_.NET.htm#overview

i really really really will appreciate any help because I haven't been able to find any good documentation
#11
.NET Platform / Click Events with User Controls?
December 31, 2008, 08:29 PM
I have made custom buttons but I am having trouble handling the mouseclick event from the parent. How can I do this?
#12
C/C++ Programming / Socket events in mfc?
November 03, 2008, 12:41 AM
I've recently started a new bot project in mfc (I've never used mfc before) but I'm stuck with the socket connections. I'm using mswinsck.ocx in my app like in visual basic. I'm not sure how to send messages to the winsock control to connect and receive data and etc.

Any help or suggestions? I would really appreciate it I've been searching all over but haven't found anything helpful.
#13
.NET Platform / Re: ListView question
October 04, 2008, 12:59 AM
Thanks lol but one last question, sort of a beginner question too.

How do I make it so when I scroll the listbox (I changed to a listbox, you are right it is much easier) the images dont flicker. Like microsoft said, override DoubleBuffer but I'm not sure how? I'm doing this in C#
#14
.NET Platform / ListView question
October 03, 2008, 06:46 PM
This has somewhat to do with bot development

What properties do I need to set to have my listview display one user (item) per line, have vertical scrollbars ONLY, and have a second column (not sure if it actually is another column) that shows another image (example: latency)

(so that it looks like the Starcraft channel list)
#15
C/C++ Programming / Re: SetConsoleTextAttribute
September 20, 2008, 12:05 PM
I think the problem was that the color changes all the text after the cursor position. I think cout does not move the cursor as it outputs text which is why I could only make one color per line.

But WriteConsole does work, thanks!