Answer Questions
Spog Mog Importing class from dll
Hi My problem is that I cannot import a class from a dll without an import library. Thank You, Attila. Theres your problem. extern "C" __declspec(dllexport) int writeSerialPort(int numberOfBytesToWrite, char* data, unsigned long *bytes_sent) typedef int (WINAPI* _writeSerialPort)(int numberOfBytesToWrite, char* data, unsigned long *bytes_sent); _writeSerialPort writeSerialPort; In the exe you h ...Show All
babakl Unnecessary calls to copy constructor when creating std::vector
I created a vector as std::vector<MyClass> my_vec(3); I expected that this to call the default constructor for MyClass 3 times. Instead it called the default constructor once and the copy constructor 3 time. In other words, it was creating a MyClass object and then copying it to each element of the vector. This seems inefficient ...Show All
fstester How can I call BIOS Interrupts in VC++?
Hello I`m new to VC++,I tried to compile this code in VC++ but I couldn`t but when I did this in TC++ ,it was compiled with no problem. #include <conio.h> #include <stdio.h> #include <dos.h> void goto_xy( int x , int y); void main(){ void cls() ; register int x, y ; cls() ; goto_xy(10, 10) ; printf( "this is a test." ); getch();} //******************* vo ...Show All
Scott Cairney Opening files from explorer.
I have associated the extention .vip to my program Viper.exe. However, I have no idea how to make the program open the .vip file that has been opened in explorer! How do you find out which file was double clicked to open the filw. Thanks in advance. Hiya wrote: I have associated the extention .vip to my program Viper.exe. However, I have no idea how to make the program open the .vip file that has been opened in explorer! How ...Show All
Graham Williams vc2005: strcpy(char[100], CString); doen't work. Why?
Hi, Recently I updated to Visual Studio 2005 (from 2003) In VC++2003 this code worked: char SuperString1[100]; //m_supervar is a member variable associated with some Dialog Edit contron (CString) strncpy(SuperString1, m_supervar, 5); This does not compile in VC++2005... the same problem with strcpy... So question is how to convert CString to char in VC++2005 Thanks in advance Serhiy ...Show All
HyperX Code formatting?
I need to format aprox 850 C/C++ files to all be the same. I was thinking at first I could do this with regular expressions to pull the information I need, then format a little bit at a time. However I cannot think of how this could be done since code could be written in many diffrent "formats". One regular expression would not work on everything Does anyone have any ideas or samples of ways I could possibly go about doing this Or even a program ...Show All
Labhesh Shrimali simle form in c++
CODE bool InitWindowApp(HINSTANCE instanceHandle, int Show); int Run(); LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam); int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, PSTR pCmdLine, int nShowCmd) { if(!InitWindowApp(hInstance, nShowCmd)) { ::MessageBox(0, "Failed to create Window!", "Fail", MB_OK); return 0; } } bool InitWindowApp(HINSTANCE instanceHandle, int Show ...Show All
German Schuager Trouble trying to initialize an unsized string
I am getting "Access violation writing location 0x00000000" when trying the following m_pstrName = new char [strlen(n)]; the variable m_pstrName is declared like this char * m_pstrName What is going on. Hi, The problem most likely is that len of "n" is 0. Max Assuming m_pstrName is actually an instance member (as its name suggests) m_pstrName = new char[strlen(n ...Show All
thedawn Using classes from dynamically linked DLL
I am attempting to use classes that are defined in my custom written DLLs. I am dynamically loading the DLLs using LoadLibrary. I already know how to access functions using GetProcAddress. Is it possible to do something similar for classes My plugin already knows what VirtTestBase is, I have simply put its header file in with the plugin. The problem is in reverse, the main program does not know about VirtT ...Show All
anu0987 Initializing statics in native library
Hello. We have a native C++ .lib that we have created that uses a const string in it. The string is initialized to "". We have successfully linked this native library to a managed Windows C++ Forms project and have code in the form to instantiate one of the objects defined in the native library. However, when the Forms application starts, it attempts to instantiate the const string in the native library and a _CrtIsValidHeapPoint ...Show All
TroyB VC++ const char * and MISRA
We write a lot of code using VC++ that is first created & debugged on a Windows platform before being implemented in various embedded platforms. The company has recently changed from it's optional guidelines to enforced use of it's guidelines + MISRA guidelines (http://www.misra.org.uk/), and this seems to conflict with the way VC++ works. For example, one of the enforced guidelines is that all variables must state at definition whether th ...Show All
KenH&#43;&#43; Why do I get OutOfMemoryException?
Why do I get OutOfMemoryException running the following code m_lst = gcnew System::Collections::Generic::List<array<double>^>; for(int i=0; i<10; i++) { m_lst->Add( gcnew array<double>(512*512*100) ); } (Create a WinForm app and insert this code at the end of InitializeComponents) I got the exception when i=5. (that is only ~1GB of memory). I know that is a lot of memory, but my computer has 2.5GB of RAM ...Show All
Brent Snyder changing from VS 6.0 to VS 2005
I have a compilation error when i transfered from VS 6.0 to VS 2005. This is the error 7 error C3861: 'AssignCopy': identifier not found c:\dev\commonfiles\myclasses.h 95. when i was given this program 2 make the necessary changes i was told that AssignCopy was in a predefined copy class and this is it #include "afxmt.h". Any help would be appreciated. Thanxx CUnderscoreInName(CString& st ...Show All
ntodorovic Sealed classes
How can we implement sealed classes in C++ Than make it protected. If the constructor is protected or private no onw can create an object of this instance. Except a static function or you derive from it. class A { A() {} }; void foo() { A instanceOfA; } Gives an error as expected! Hi, Thanks . If we implement the class with private constructor, we can't inherit. ...Show All
bmoreno 'cli::array<Type> ^' to 'void *'
Hello Everyone, thats how it looks cli:: array < unsigned char > ^passwordHash how can I convert to void *, I'm passing to a function which looks like this... int sha_hash( const void * init_data_ptr, int data_length, void * buffer_ptr, int buffer_length, void * prefix_ptr, int prefix_length ) Its gonna get sent as (void * buffer_ptr) Any help really appreciated... Thanks, Ha ...Show All
