Answer Questions
SPDOTNET Can I debug???
Hi, I worte an MFC program and compiled it in "Debug", but I compiled it in "Release" configuration. Then, I modified my code for additional functionality, but I can't debug the program anymore with "Debug" configuration. It gave me error like "Debug Assertion Failed" when I ran program in "Debug" mode. I do want to debug my program for its correctness. Do you have any idea how I can debug Thanks, vcboy An assertion in your program has fired. Assertions are enabled on debug builds and not on release builds. You are debugging, from what I can tell. Where is the assertion (i.e. which line of code ) ...Show All
Mark Macumber AfxRegisterWndClass() troubles
Hello all, in "CMainFrame::PreCreateWindow(...)", directly underneath "cs.style = ..." and where it says "// Modify the Window class or styles here by modifying the CREATESTRUCT cs" I've added the following: cs.lpszClass = AfxRegisterWndClass(CS_DBCLKS | CS_HREDRAW | CS_VREDRAW, AfxGetApp()->LoadStandardCursor(IDC_ARROW), CreateSolidBrush(RGB(0,0,0)), ::LoadIcon(NULL, IDI_APPLICATION)); My client area always remains white, however. Why doesn't this change its color to black Can't find the solution on the web nor in any of my MFC references. As always, many thanks everyone. In my opinion the displayed background actually does not belong to your CMainFrame ...Show All
macyp How to use NetValidatePasswordPolicy API?
Hello, Thank you in advance. I have a question on using NetValidatePasswordPolicy API. /// <summary> /// NET_API_STATUS NetValidatePasswordPolicy( /// LPCWSTR ServerName, /// LPVOID Qualifier, /// NET_VALIDATE_PASSWORD_TYPE ValidationType, /// LPVOID InputArg, /// LPVOID OutputArg /// ); /// </summary> [ DllImport ( "netapi32.dll" , EntryPoint = "NetValidatePasswordPolicy" , SetLastError = true )] public static extern PolicyValidationDataTypes . NET_API_STATUS NetValidatePasswordPolicy( string ServerName , IntPtr Qualifier , PolicyValidationDataTypes . NET_VALIDATE_PASSWORD_TYPE validationType , IntPtr Inpu ...Show All
leok How do you compile a COM compliant C++ DLL in Visual Studio 6?
I am trying to use a DLL written in C++ and compiled in Visual Studio 6 in .NET. Unfortunately, I cannot reference the DLL in .NET because it is not COM compliant. I am not very familiar with Visual Studio 6 and was hoping there is a fairly easy way to compile C++ code into a COM compliant DLL. Thanks for you help, both suggestions are helpful. You don't have to add COM to existing C/C++ DLLs to call them from .NET. You can use P/Invoke to call functions written in C/C++ (but identifying C functions is far more simple). Look up DllImport on the web for more info. The best way to create a COM object is through the ATL wizard. If you ha ...Show All
rajendra patel Weird "Goto" statement
I was reading an article entitled "The Case for Virtual Register Machines," where it had this code snippet: typedef void *Inst; void engine() { static Bytecode program[] = { iadd /* ... */ }; Bytecode *ip; Inst dispatch_table = { &&nop, &&aload_null, .... }; int *sp; goto dispatch_table[*ip]; iadd: dest = ip[1]; s1 = ip[2]; s2 = ip[3]; reg[dest]=reg[s1]+reg[s2]; ip+=4; goto dispatch_table[*ip]; } I've never seen "goto" used that way. I thought it could only be used for jumping to labels. Anyone know what this is about You are correct: neither Standard C++ nor Standard C supports syntax like this - they only support goto label. Having said that I have seen syntax like this i ...Show All
bilalso Visual C++ 5.0 Support
Hi All, I do not think this is the correct forum for asking this question, but I have also not found a suitable forum to post this question. The question is 'Has Microsoft Withdrawn support for Visual C++ 5.0 or Visual C++ 6.0 " This is important as my department would go on and buy Visual Studio 2005 and invest the time required to convert all our projects created in Visual C++ 5.0 to Visual Studio 2005. thanks and regards Saby Yes the official support for VC 6.0 and previous versions already expired. Thanks, Ayman Shoukry VC++ Team Thanks Ayman, That confirmed it. Saby. Moving to the VC++ forum Tim <MSFT> ...Show All
AmitKa MFC
Helle, I used the following code to generate an empty window: //MFC1.CPP - MFC Tutorial Part 1 #include <afxwin.h> class MFC_Tutorial_Window :public CFrameWnd { public: MFC_Tutorial_Window() { Create(NULL,_T("Test Window")); } }; class MyApp :public CWinApp { MFC_Tutorial_Window *wnd; public: BOOL InitInstance() { wnd = new MFC_Tutorial_Window(); m_pMainWnd = wnd; m_pMainWnd->ShowWindow(SW_SHOW); return TRUE; } }; MyApp theApp ; //End of program MFC Tutorial Part 1 Anyways, now, how can I add controls Or please point me to a reference or a tutorial on this! Thanks! Keehun Nam That looks like an old sample. You should get a newer book/tutorial. Most MFC program ...Show All
r3zonance STL Thread Safety
So, I looked for STL thread safety, and there are only two hits: One in Visual C++ Express Edition , and the other in Visual C# Language . Where's the best place to discuss MSVC 2005's STL thread safety -MM This is probably a better location. C# knows nothing about the Standard C++ Library. The current C++ Standard Library - like the rest of the current C++ Standard - knows nothing about threads and thread-safety - it assumes a single threaded world. This may change in the next revision of the C++ Standard but for now if you are using the C++ Standard Library in a multithreaded environment then you, the programmer, are responsible for handling all threading issues. This was moved he ...Show All
.NETPhreak how to write single byte to a file..
Hi! what is the correct syntax to write a single byte to a file I only want to use 0 - 255 -- 0 to FF The problem I'm having is once my number goes over 127 the program writes two bytes what do I have to us to write a single byte and not the multi-btye write sw->Write(Char( I'm using VS2005 Pro C++/CLI managed Ok thanks after you threw the word BinaryWriter at me I did some surfing and found more info on BinaryWriter BinaryWriter also writes the double byte but BinaryWriter will let me throw this in the mix bw->Write(Convert::ToByte(Char(x))); then it will write the single byte that I need ....... I tried using the convert to byte in streamwriter but it wi ...Show All
Jess Chan System::IO::Packaging question
I decided to tinker around with the new Word 2007 file formats and to do this i understand i need members of the System::IO::Packaging namespace. I've installed the SDK, Framework 3.0, and various other things (e.g. the WPF tools, etc) but the System::IO::Packaging namespace still doesn't seem to exist. Am i missing a step somewhere " "Chris A. Palmer"@discussions.microsoft.com " < "= UTF-8 B Q2hyaXMgQS4gUGFsbWVy ="@discussions.microsoft.com > wrote in message news:5fe041fb-ad9c-45ed-8bc8-76e406f20b36@discussions.microsoft.com ... I decided to tinker around with the new Word 2007 file formats and to do this i understand i need members of the System::IO::Packagin ...Show All
calmal20 Making the IP Address control remember my settings
I have an SDI based MFC application in VS dot NET-2003,in which I create a dialog box on an event.The dialog box has tabs,one of which contains the IP address control. I would like to initialise the control,and if the user changes the ip,it should be rembered in the control,i.e. if the dialog box is generated again,the modified ip address is diaplayed. The same process for an edit control on the same tab.How do I implement this I tried adding a flag variable during initialisation of the dialog box,but the flag is initialised to the same value each time the dialog box is generated. Please throw some light! Thanks runtime data stored memory ui controls display data during init update recent data Kuphryn ...Show All
Priyank Gajera LNK2001: using unmanangedC++ in manC++
Hi, i'm writing a new user-interface for a small software-company. The old interface should be replaced by the new one, the "inner core" should stay. The old program was written in unmanaged C++, but now I'm writing the user-interface in C#, so I have to use class wrappers. While building the managed C++-project (in a solution with the unman. C++-projects) there a some errors. For example: Error error LNK2001: unresolved external symbol ___argv nafxcwd.lib and Error error LNK2001: unresolved external symbol ___argc nafxcwd.lib Another one: Error error LNK2001: unresolved external symbol __pgmptr db.lib [db is one of the old unmanaged C++-projects] The settings are the following: Linker->Input->Add. Dep ...Show All
Troy Lundin How to Link Multiple Project
Hi Experts, I have created two projects in a single workspace in Visual C++. How can I Link the two projects to work together Thanks Tonmoy To use COM, you need to recreate your projects so they are ATL based, and your public interface is defined in IDL. If you have 3 windows programs, WM_COPYDATA is a more sensible way to go, this allows you to pass messages between programs. Hi, Thanks for your valuable comment. I don't want to copy the files into one project. Becasue I would like to know how to implement the mechansim using COM / other (as you said in case of exe). I gave an simple example to learn. So, pls help me about how I can use COM. Thanks Tonmoy ...Show All
EnigMa_AnGeL Drawing to a MemDC with CRichEditCtrl
I'm trying to have my CRichEditCtrl's render to a memory dc. I was expecting to be able to just use SetTargetDevice( MyMemDC, ...) but it doesn't work. Any ideas most appreciated. Also, please let me know if there's a more appropriate place for this question. I looked for Win32 and/or MFC forum but couldn't find one. What about it doesn't work Are you getting compiletime errors or runtime errors I haven't worked with MFC specifically but this doesn't sound like an MFC-specific issue. Sorry, fixed the link! Please move discussions about application development to the proper place. e.g. http://msdn.microsoft.com/newsgroups This forum is specificall ...Show All
Drakuz error LNK2019
Hi I got error LNK2019 and error LNK 1120 on compiling the following code for sorting integers in accending order: How do i fix it #include<iostream> using namespace std; int max(int,int); int min(int,int); int sortarray(int); int main() { int i,c,temp,newarr ,finalarr ; int arr ={2,3,4,5,6,7}; finalarr =sortarray(arr ); cout<<"the sorted array is "<<endl <<finalarr ; } int sortarray(int newarr ) { int b,c,i,arr ; b=0; for(c=0;c<6;c++){ for(i=1;i<6;i++){ min(arr ,arr ); arr =min(arr ,arr ); newarr =arr ; b++;}} return newarr ; } int max(int a, int b) { if (a>b) return a; return b; } int min(int a, int b) { if (a<b) return a; return b; } Well, your ...Show All
