196 Topics
I have the following code which tracks the mouse movements on a control and if the mouse hovers it will beep. I want it to draw specific images on Hover and when it leaves, draw a different image. How can I accomplish this? I subclassed the buttons to figure out … | |
I have a button created as follows: ~~~ HWND License; HBITMAP MainButtons; Case WM_CREATE: License = CreateWindowEx(WS_EX_TRANSPARENT, L"Button", L"License", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP | BS_BITMAP, 26, 77, 75, 23, hwnd, (HMENU)ID_LICENSE, hInst, 0); MainButtons = (HBITMAP)LoadImage(GetModuleHandle(NULL), MAKEINTRESOURCE(IDI_MAINBUTTONS), IMAGE_BITMAP, 0, 0, LR_SHARED); SendMessage(License, BM_SETIMAGE, IMAGE_BITMAP, (LPARAM)MainButtons); break; ~~~ … | |
I'm trying to clip my Button with the following code but it does not work at all.. #pragma comment(linker,"\"/manifestdependency:type='win32' \ name='Microsoft.Windows.Common-Controls' version='6.0.0.0' \ processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"") #pragma comment(lib, "Gdiplus.lib") void RegionCloseButton(HWND hwnd) { CloseRegion = GetDC(hwnd); CloseRegionMem = CreateCompatibleDC(CloseRegion); Gdiplus::Graphics graphics(CloseRegion); Gdiplus::FontFamily fontFamily(L"Courier New"); Gdiplus::GraphicsPath path; Gdiplus::PointF Origin(5, 5); path.AddString(L"X", … | |
Hey all, I've been searching Rohitab, CodeProject and various other sites to figure out how to write OPCodes to a file and cannot figure it out. I thought I'd ask here because it's the only site I have an account on and I usually get my answers here or hints. … | |
Does C++ Console apps have a TryParse equivalent.. I mean .Net has it for both C# and C++ but why does C++ Consoles NOT have this! Or am I just wrong and cannot find it? I was thinking of writing my own with templates that can be use for ANY … | |
How can I have my program modify itself? Example: Size = 1mb ..Run program once.. size = ++1mb On Second Run, check if itself is 1mb Or something of the sort :S. I need to be able to check if my program has ever been ran before.. So.. Is there … | |
void DLL_EXPORT Replace(LPCTSTR OriginalFile, LPCTSTR FileToReplace, LPCTSTR BackupOfFileToReplace) { HGLOBAL LoadResource(HMODULE hModule, HRSRC hResInfo); try { BOOL WINAPI ReplaceFile(OriginalFile, FileToReplace, BackupOfFileToReplace); MessageBox(NULL, "Done", "Alert", 0); } catch (...){} } The above is my code and it gives me errors like: In function 'void Replace(LPCTSTR, LPCTSTR, LPCTSTR)':| warning: '__stdcall__' attribute only … | |
Hey all, Back with another Win32 question. When I paint to my window (create a background image), what happens is that everything is fine until I draw the window off the screen causing it to invalidate everything.. When dragged back onscreen, my background is redrawn but my controls are all … | |
case WM_MOUSEMOVE: if (wParam & MK_LBUTTON) { RECT WindowRect; POINT CursorPos; GetWindowRect(hwnd, &WindowRect); GetCursorPos(&CursorPos); SetWindowPos(hwnd, 0, WindowRect.left - CursorPos.x, WindowRect.top - CursorPos.y, 291, 157, 0); } break; Hey Guys The above code isn't working for me. I'm trying to have the user Drag my borderless window but the thing just … | |
I have a modified a DLL called UserEnv and I decided to check out reverse engineering and assembly.. When my DLL Loads, it writes and displays a messagebox saying it's loaded.. Sorta like injection into notepad which I learned from: [How To Inject Into Notepad](http://home.inf.fh-rhein-sieg.de/~ikarim2s/how2injectcode/code_inject.html) The DLL Now looks like: … | |
I need someone to check my bitmap class for me. I load a bitmap from a file but I cannot get it to draw to the specified window :S I'm not sure if I'm loading it right or how to get the pixel data for BOTH 32 and 24 bit … | |
Why does my delete function crash? I've used the same algorithm for other 2D vectors and it works perfectly fine.. I'm trying to remove an array of vectors from a 2D vector all of the std::string type. [CODE] //Ripped out of a massive class I wrote. vector<vector<string>>& Delete(vector<string> StringArrayToDelete, bool … | |
Is there anyway I can specialize JUST the Contains function of the class below? I tried for hours and cannot figure it out as I'm not too good at specialization but I learned templates recently. I want to do something like: [CODE] bool Contains(string ToFind) { //If typeof(T) == typeof(string) … | |
It reads in the whole file.. thing is, it crashes right after it hits the last line in the file.. the file is 115 lines long.. it prints all 115 lines but for some odd reason, it crashes right after :S If I remove the blank line at the end … | |
I'm trying to help someone with homework.. So you do not have to give me direct answers if you don't want to.. it is not my homework. [CODE] class Types { //No default constructor.. Types(int Param1, int Param2); }; class Objects { public: Types* Original; Objects(); ~Objects(); }; //The problem … | |
I need help changing my return type from int to vector<string>.. I don't want to have to pass the vector as a pointer to the function but rather I just want to return the vector itself as I no longer need to check the return type. If it fails, it'd … | |
K so atm, I'm having problems understanding ENDIF and IFDEF preprocessor stuff.. I want to Use a specific method if a file is included.. If not, use a different method.. Since toupper is defined in CCType I tried to check if that file was included.. if it was, use toupper … | |
Hey guys I'm having an extremely hard time splitting or combining values into binary.. [CODE] #define Chr(n) ((char)(n)) #define Ord(c) ((int)(unsigned char)(c)) int DecToBin(int Num) { int Bin = 0, Pos = 1; while (Num > 0) { Bin += (Num % 2) * Pos; Num /= 2; Pos *= … | |
How can I make my DLL constantly check for hotkeys but without affecting other functions in it? If I put a loop, it will not be able to get any other calls to functions.. Do I create a thread and pass my functions to the thread upon attachment? My silly … | |
I'm trying to convert this (Pascal) to C++.. My attempt is below this.. [CODE] function CompressString(const Str: string): string; var Destlen:longword; begin result := ''; Destlen :=BufferLen; if length(str) < 1 then exit; if compress(BufferString,destlen,PChar(Str),length(str)) = Z_OK then begin setlength(result,Destlen + SizeOf(Integer)); PInteger(@result[1])^ := Length(str); Move(bufferstring[0],result[5],Destlen); end; end; [/CODE] [CODE] … | |
My code is: [CODE] #include <windows.h> #include <iostream> using namespace std; struct ReplacementFlags { public: bool rfReplaceAll, rfIgnoreCase; ReplacementFlags(bool ReplaceAll = false, bool IgnoreCase = false) : rfReplaceAll(ReplaceAll), rfIgnoreCase(IgnoreCase) {} ~ReplacementFlags() {} ReplacementFlags& operator ()(bool ReplaceAll = false, bool IgnoreCase = false) { if((rfReplaceAll != ReplaceAll) && (rfIgnoreCase != IgnoreCase)) … | |
When do I really need to use Delete in Destructors? if I do Point P = new Point(); I've been told every time I use new, it stays in memory even when out of scope and that I should use delete to remove it.. so do i need to do … | |
I did not know WHERE to ask this as there is no "General" section on the site this site that I know of. Lets say I found code online but it's under the GPL 3 License.. I read it but it doesn't say that I cannot translate it from Pascal … | |
Am I wrong that the answer is 2?? Teacher refuses and says that it's 3 because the compiler spits out 3 for ans.. but if I do it manually with pen an paper or with the cout<<v2%v1++, it spits out 2 which is what I get on paper.. [CODE] #include … | |
How can I check if a template's parameter is empty? Or of a "certain type"? I'd prefer to check if it's empty or not rather than the type because if the wrong type is entered, it'd throw an error anyway.. But I definitely need to know if the parameter passed … | |
I'll get straight to the point as it's very difficult to do since I haven't found the answer on google or anywhere else. [CODE] Class ArrayOfTypes { vector<MyType> P; &MyType operator [](int I) = (MyType& PT) { if (P[I] != PT) { P[I] = PT; } return P[I]; } } … | |
Is it Dangerous to Derive from STD? Specifically std::string. Why I'm asking? I want to write a class that extends the functionality of std::string and a couple other std structs/classes.. So that when I do something like: String M = ""; M.Explode(........) it'll do the functionality in my class below. … | |
How can I get a variable amount of arguments in a function without providing how many arguments will be passed? For example, when you use a VA List, the first parameter must be the amount of arguments passed.. I don't want that. I want to just start passing any amount … | |
I have: [CODE] private: Void GoBtn_Click(Object^ sender, EventArgs^ e) { ((WebBrowser)MultiTab->SelectedTab->Controls[0]).Navigate(SearchBar->Text); } [/CODE] But it keeps giving me an error at Controls[0] and telling me that no operator [] matches.. Control::Collection^ [int] <--- No clue what that line means.. Next it tells me that I cannot cast TabControl to (WebBrowser) … | |
How can I do the following? I read up on Variable Arguments last time I asked this question (Mike pointed me in the right direction).. but it still does not let me define any number of them.. I Do not want to specify the first parameter and if I do, … | |
Is there any C++ .Net IDE's around? I mean visual studio is ok.. it just isn't as good as SharpDevelop which only does C#, VB and a few others. It doesn't do C++ that's why I'm looking for a C++ version of SharpDevelop. Any Ideas? SharpDevelop [url]http://www.icsharpcode.net/opensource/sd/[/url] | |
I have: [CODE] class ANew { private: vector<CustomType> ArrayOfTypes; public: ANew() : ArrayOfTypes(0) {} ~ANew() {} ANew& operator ()(int I) { return ArrayOfTypes[I]; } operator const ANew* () const { return ArrayOfTypes; } }; [/CODE] But it gives me these errors: [ICODE]C++\Types.h|12|error: invalid initialization of reference of type 'ANew&' from … | |
Someone please tell me the difference between 0 and '\0' and NULL. I thought I knew it! 0 and NULL is the same thing "Essentially".. '\0' is a null terminator for a string.. It's just sometimes when I convert a string to char array and do some encryption on it, … | |
I read a LOT of tutorials on bitmaps. I learned that RGBQuad is for 32 bit bitmaps and RGBTripple is for 24 bit bitmaps.. I'm planning on getting pixel information from a bitmap that can be of 3 types. 24bit, 32bit, 32bit with alpha (Transparent). Thing is, I don't know … | |
Sorry for using Inception in the title but it's the only way I think I can describe it.. Take this for example: Definition.H [CODE] struct XY { string info; string name; string tag; string attrib; }; //is it better to create an object here inorder to make the array? struct … | |
The below code is what I have.. It's a custom type I made called Points that stores co-ordinates on the screen.. The problem is in the PointsArray Struct. When I declare one like so: [CODE] PointArray P; Point A(10, 5); for (int I = 0; I < 5; I++) { … | |
How can I forward declare a struct/custom type in my include? I'm trying to write an include but it keeps telling me incomplete type or type not declared.. I do not have a .CPP to go with it.. I wrote everything in here as I have never written an include … | |
In pascal, you can have something like the following: [CODE] type TPoint = record X, Y: Integer; end; TPointArray = array of TPoint; T2DPointArray = array of TPointArray; [/CODE] In C++ I tried to replicate this and failed miserably. [CODE] struct Point { X: Integer; Y: Integer; }; struct PointArray … | |
How can I detect 3D Images? These images rotate in every direction in a game and I want to be able to detect them and click the right ones. Where would I start? I was thinking just loading a lot of bitmaps and somehow making a 3D image of it … | |
Why does it load my DLL but the pointer to the Proc returns 0? It loads the DLL and says "DLL Loaded" but it just won't say "Function Found." Help me please :)? [CODE] #include <windows.h> #include <iostream> //DLL Function: void DLL_EXPORT Theading(HANDLE hThread, DWORD ThreadID, void* FunctionToPass); typedef void … | |
Hey all, I'm trying to make a DLL that can be used in Pascal to enable multi-threading. I've decided I want to export Threads in C++ to a DLL. Before I make DLL's I usually write the program first to test everything then I convert it to a DLL. [CODE] … | |
How do interpreters do it? I've seen bots for games that encrypt files then decrypt them at runtime and run what's in them.. Well How? How can I do this in C++? I plan to do this in another language but I decided to ask in C++ section because this … | |
I have an idea for a program but I don't know if its possible. I want to write a program that can read commands from a file.. For example, I've seen bots that can parse and read javascript for games and execute whatever is in the .java file.. How can … | |
Hey all, I'm a c++ programmer and I'm REALLY new to pascal. I want to translate some of my programs into pascal just for the experience. The thing is, this Lazarus compiler is soooo confusing! All the windows are split apart.. How can I join them? Next is how can … | |
My problem is at line 54 and line 124.. Not sure how to fix it at all.. I basically just want to store all the values of NameIdx to the vector and print the values of the vector. But instead if shows random/AltKeyCode characters and crashes. I know its probably … | |
I have a page that has a hidden button at the top. When a link is clicked, the button shows. I want to write javascript so that if the button is showing, add a breakline below it and if it is not showing, do nothing. My attempt & fail is … ![]() | |
I have an iframe that loads a page inside it.. when a link is clicked on the page in the iframe, resize the body of the parent aka the document that has the iframe's body.. Example: [CODE]Body <------------------------ Iframe | Page | Link... Upon Click, resize --[/CODE] How do I … | |
Can someone explain why my function is not working? Description: ToggleFrame(TagID, FrameID).. Given those two, get the two elements.. If the iframe is showing, hide the tagID element.. if the tagID element is showing, hide the iframe.. My attempt & failure: [CODE] function ToggleFrame(ID, FrameID){ //Given the tag, show/hide it.. … | |
Trying to re-write a php function to C++ using boost.. I have NOT seen code for this anywhere on the net. I thought it was useful and I need it for C++ but I need help.. definition of the function in c++ [CODE] void preg(string pattern, string subject, string &matches, … | |
I have a file that has the layout: [CODE] 0 0 0 1 1 0 1 1 [/CODE] I want to read it into a multidimensional array and use the values. The thing is I don't know how to read it in.. I can read the amount of columns and … |
The End.