visual-c++

How can i check that button is clicked in no modal dialog

I created main dialog and call no modal dialog, how can i check in main dialog that button is clicked in no modal? For example if i call modal i can check like this: Dialog Dlg; int DlgResult = static_cast<int>(Dlg.DoModal()); if (DlgResult== IDOK) { //do smth. } ...

C++/CLI Converting System::String to const char*

I'm using Microsoft Visual C++ 2008 I want to join some strings, and then use it with "system" command. I tried to do it like this: System::String^ link; link = "wget.exe --output-document=log http://ADDRESS"; link = link + System::String::Copy(textBox_login->Text); link = link + "&passwd="; link = link + System::String::Copy(textBox_p...

How to GCC compile without _alloca ?

For some reason, I should use gcc to compile a C file, then link against Visual C++ 2008 project. (I used the current latest gcc version: cygwin gcc 4.3.4 20090804.) But there is one problem: gcc always allocate a big array with _alloca, and VC linker can't resolve the symbol __alloca. for example, int func() { int big[10240]; ...

wglCreateContext() everytime return NULL in OpenGL and Visual C++

Hi, I'm new in OpenGL. I want to draw somethink using OpenGL in Windows Forms. If I use Win32 application with WinMain method, application working. In WinMain method, I fill HWND with CreateWindow() function and ı give WinMain parameters to CreateWindows. But I want to get Handle from Windows form i cant get this. Everytime wglCreateC...

System.AccessViolationException while initializing an array.

void BinaryTree::InitializeFromFile(string Filename){ ifstream inFile; treenode* Freq[256]; inFile.open(Filename.c_str(), fstream::binary); if(inFile.fail()){ cout<<"Error in opening file "<<Filename; return; } for(int i=0;i<=255;i++){ Freq[i]->weight=0; Freq[i]->data = '0'+i; Freq[i]->LChild = NULL; Freq[i]->RChild=NU...

Visual Studio Standard C++ 2008 autocomplete

I feel a little dumb asking this question but I can't figure it out. When programming in C++ I want the autocomplete to show up like in VB or C#. Now I have to hit ctrl+space to get it show up and I can't get it to come up automatically. Where's the setting for this? ...

How to show OpenGL in PictureBox in Visual C++

Hi, I want to show OpenGL processes in Windows Form PictureBox. I am using Visual C++. I'm taking user values on Windows Form Interface and I must draw chart for this values. Do you know any document or sample? ...

Problem with D3D & COM

all the D3D interfaces are derived from COM's IUnknown interface, so I though I'd take an easy route for releasing D3D objects and use something like this: __inline BOOL SafeRelease(IUnknown*& pUnknown) { if(pUnknown != NULL && FAILED(pUnknown->Release())) return FALSE; pUnknown = NULL; return TRUE; } this doesn't...

scanf_s throws exception

Why does the following code throw an exception when getting to the second scanf_s after entering an number to put into the struct. This by no means represents a complete linked list implementation. Not sure how to get onto the next scanf_s when having entered the value? Any ideas? EDIT: Updated code with suggested solution, but still ...

C++/CLI Converting System::Object ^ to std::basic_string<_Elem,_Traits,_Ax>

I have a listBox in Visual C++ 2008, and I want the first line convert to string. So first, I select the first line listBox1->SetSelected( 0, true ); And afterwards, I want to convert it to string string t = listBox1->SelectedItems[ 0 ]; Which results in an error: error C2440: 'initializing' : cannot convert from 'System::Obje...

Using __int64 and std::ostringstream in VC6

May I know what is the workaround to make this code passed, in Visual C++ 6? #include <sstream> int main() { std::ostringstream ss; ss << 123; __int64 i; // error C2593: 'operator <<' is ambiguous ss << i; } Upgrade the compiler is not a choice, as I need to use this old compiler, to interface with a legacy system...

Add a tooltip to a CStatic Ctrl

Is it possible to add a tooltip to a CStatic Ctrl in Visual C++6? How? ...

Deleting an std::map (Visual C++)

Hi, I have a pointer to a map that I am trying to delete (this map was allocated with new). This map is valid I think, when I hover on it while debugging, it shows pMap: [0]() .. When I try to delete this empty map, my app just quits and I get a First-chance exception at 0xsomelocation in myapp.exe: 0xsomenumber: The object invo...

__attribute__((format(printf, 1, 2))) for MSVC ?

With GCC, I can specify __attribute__((format(printf, 1, 2))) , telling the compiler that this function takes vararg parameters that are printf format specifiers. This is very helpful in the cases where I wrap e.g. the vsprintf function family. I can have extern void log_error(const char *format, ...) __attribute__((format(printf, 1, ...

CDialog Object assigning

CDialog *m_Dlg = NULL; m_Dlg=this; plese any body explain what happens if we assign a CDialog object to this.In the above example m_dlg=this; what m_dlg does. ...

VCBuild link errors from command line

I am using external libraries from my VC Express project. I am trying to automate my build through the command line, but it seems VCBuild does not recognize the additional directories I saved/added for the external library's include and lib directories. Is there a workaround to this? ...

A simple way to convert to/from VARIANT types in C++

Are there any easy-to-use, high-level classes or libraries that let you interact with VARIANTs in Visual C++? More specifically, I'd like to convert between POD types (e.g. double, long), strings (e.g. CString), and containers (e.g. std::vector) and VARIANTs. For example: long val = 42; VARIANT var; if (ToVariant(val, var)) ... ...

Runtime Library mis-matches and VC++ - Oh, the misery!

It seems that all my adult life I've been tormented by the VC++ linker complaining or balking because various libraries do not agree on which version of the Runtime library to use. I'm never in the mood to master that dismal subject. So I just try to mess with it until it works. The error messages are never useful. Neither is the Mic...

Debugging a minidump in Visual Studio where the call stack is null

I have a customer who is getting a 100% reproduceable crash that I can't replicate in my program compiled in Visual Studio 2005. I sent them a debug build of my program and kept all the PDB and DLL files handy. They sent me the minidump file, but when I open it I get: "Unhandled exception at 0x00000000 in MiniDump.dmp: 0xC0000005: Acces...

Radio Button Transparency Problem

Hi, I want to make radio control transparent i tried with OnCtlColor it is not on radio control working but it is working on Static Text Control .when i put my control over a picture control with bitmap it is getting black.I am using MFC Dialog. here is the code HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor); if(nCtlColor == CT...