Looking to buy Visual C++ 2005 Standard, does it exist? I tried to do that at the end of last year to get Office but the site was so busy I could not get in. Then I could not find the link to get back. If that type of deal still exists, then it is probably quite worthwhile. Tag: Visual C++ General user innput possible ?? Visual C++
compatibility of commercial package API's written with Visual C++ 7 .NET with more recent release of Vis C++ crescens2k wrote:
The best method of doing something like this is to define simple APIs which don't take any parameters which are complex types if you can help it. This will rule out classes and structures. If I understand the OP right, they are asking whether or not they will be able to use the libraries, not write them Tag: Visual C++ General user innput possible ?? Visual C++
Linker problems LNK2001 As far as I can think and as far as I know, there must be something unusual for you.
What happens when you create a new MFC project and build it immediately; that is, without any modifications Tag: Visual C++ General user innput possible ?? Visual C++
VS 2005 Compile C in C99 mode? Hello Holger, could you explain a little bit about "__FUNC* identifiers" Did you mean __func__
Thanks. Tag: Visual C++ General user innput possible ?? Visual C++
How to identify the Type of Device plugged in to the PC Ramkrishna Pawar wrote:
Do you mean you want to identify already attached device Or the one inserted just now Both. When my program starts executing i want to detect all the currently connected devices and get their device types. After it has started executing, whenever a new device is connected, then my program must be able to detect it and get its device type. I am able to detect that a device has been plugged in to the pc. But, i am unable to get its device type (like scanner, printer, flash drive, external hard disk, etc.). I need to detect the device type for devices plugged in through USB and FireWire. Any suggestions
Marius Bancila wrote:
this looks strange to me: Code Snippet bRes =SetupDiEnumDeviceInfo(dev_info,(DWORD)i, &DeviceInfoData); if (GetLastError() == ERROR_NO_MORE_ITEMS) Why don't you check bRes first SetupDiEnumDeviceInfo() return a bool which indicates whether it was able to get the data or not.
Marius Bancila wrote:
Anyway, take a look at this example from MSDN: http://msdn2.microsoft.com/en-us/library/aa363250.aspx. I went through the link given by you. After reading it, i changed the code given there to meet my requirement i.e. i changed the values passed in the SetupDiGetDeviceRegistryProperty() . The code i used is given below : HDEVINFO hDevInfo; // Create a HDEVINFO with all present devices. hDevInfo = SetupDiGetClassDevs(NULL, NULL, NULL, DIGCF_DEVICEINTERFACE | DIGCF_ALLCLASSES ); if (hDevInfo == INVALID_HANDLE_VALUE) { // Insert error handling here. return 1; } // Enumerate through all devices in Set. DeviceInfoData.cbSize = sizeof(SP_DEVINFO_DATA); for (i=0;SetupDiEnumDeviceInfo(hDevInfo,i,&DeviceInfoData);i++) { DWORD buffersize = sizeof(dwData); DWORD DataT = 0; dwData =0; while (!SetupDiGetDeviceRegistryProperty(hDevInfo,&DeviceInfoData,SPDRP_DEVTYPE ,NULL,(PBYTE)&dwData,buffersize,&buffersize)) { DataT = GetLastError(); if (DataT == ERROR_INSUFFICIENT_BUFFER) { if (DataT) //this code is just to break execution while debugging when error occurs DataT++; } else { // Insert error handling here. TCHAR szBuf[80]; LPVOID lpMsgBuf; FormatMessage(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,NULL,DataT,MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),(LPTSTR) &lpMsgBuf,0, NULL ); wsprintf(szBuf, _T("failed with error %d: %s"), DataT, lpMsgBuf); MessageBox(NULL, szBuf, _T("Error"), MB_OK); LocalFree(lpMsgBuf); break; } } if (dwData) dwData++; //this code is just to see that a valid value for dwdata was returned while debugging } if ( GetLastError()!=NO_ERROR && GetLastError()!=ERROR_NO_MORE_ITEMS ) { // Insert error handling here. return 1; } // Cleanup SetupDiDestroyDeviceInfoList(hDevInfo); In the above code the SetupDiGetDeviceRegistryProperty() always fails. The GetLastError() returns the value 13, which is being translated by FormatMessage() as 'The Data is InValid'. Tag: Visual C++ General user innput possible ?? Visual C++
Sending Commands to any Process Well, I read about the SendInput possibility, but I didn't try it, yet. I actually don't want to use the mouse, I just want to simulate a buttonclick. But it's actually not a button, theres just the main window I can locate with spy++. All other elements seem to be images that react on clicks or something. The "button" also is in another extra dialoge which also seems to be just an image. But I found out that 0x00FF is WM_INPUT, so every mouse click / movement is a WM_INPUT command and I have lParam, too. Can I work with that Tag: Visual C++ General user innput possible ?? Visual C++
Opengl Release vs. Debug version Hi, I wrote an opengl program using .Net 2003 in C++. When I do a debug version of the program it runs perfectly, but then when I do a release version of the program I get a black screen, even though the program compiled is exactly the same. If anybody out there knows what might cause this to happen please let me know, thanks. Tag: Visual C++ General user innput possible ?? Visual C++
CTXfiHlp MFC Application has encountered a problem Hi!
By starting Windows XP a dialogue box stating the message referred to in the caption is recurring.
It also tells that the application has to be ended. What is the key function of this application and how can I elude getting these messages
Thankful for any kind of answer! Tag: Visual C++ General user innput possible ?? Visual C++
Unhandled exeption System.NullReferenceException is something you'd get with managed code. VC++6 doesn't support managed code, so you seem to have got something mixed up.
Can you paste the initialization of the joystick object Tag: Visual C++ General user innput possible ?? Visual C++
Draw bitmap using GDI+ Hi all,
I have a MDI application in which I want to display bitmap in view ( Base
class is CScrollView) with Scroll bar using GDI+, later I want to mark some
part of the image.
So plz tell me how I can draw a bitmap with Scroll bar.
Thanks and Regards
Rinu Tag: Visual C++ General user innput possible ?? Visual C++
QueryPerformanceCounter Resolution I had assumed that QueryPerformanceFrequency is the resolution for the system they are used in.
You are likely to get the best answer to this question in the microsoft.public.win32.programmer newsgroup. Tag: Visual C++ General user innput possible ?? Visual C++
sprintf_s is not a member of global namespace I neglected to mention that this is a C++ project, so String.Format isn't an option. Also, I'm not using sprintf_s anywhere, although I am using sprintf in a few places.
The error message points to Microsoft code, not mine. The file is C:\Program Files\Microsoft Visual Studio 8\VC\include \xlocnum, and the offending code starts on line 960, here:
Code Block
_VIRTUAL _OutIt __CLR_OR_THIS_CALL do_put(_OutIt _Dest,
ios_base& _Iosbase, _Elem _Fill, long _Val) const
{ // put formatted long to _Dest
const size_t _Buf_size = 2 * _MAX_INT_DIG;
char _Buf[_Buf_size], _Fmt[6];
return (_Iput(_Dest, _Iosbase, _Fill, _Buf,
::sprintf_s(_Buf, _Buf_size, _Ifmt(_Fmt, "ld" ,
_Iosbase.flags()), _Val)));
}
The error message sounds to me like it sees this reference to sprintf, but can't find its definition in the global namespace. Maybe I need to include a VS 2005 specific library
Thanks for the replies,
Dennis Tag: Visual C++ General user innput possible ?? Visual C++
How to enum access permissions and SIDs Look at WMI. I used it to do something similar and I spent a lot of time figuring it out. After I did that, someone wrote an article describing how to do what I had spent a lot of time figuring out. If you can find that article and use it then that will save you a lot of time. Tag: Visual C++ General user innput possible ?? Visual C++
Menu limitations I meant the limit for an individual menu (not the data size limit).
By the way, are you dynamically populating the menu or are you entering these 8000 entries into the resource editor If the latter, I wonder if it's a limitation of the resource compiler. Tag: Visual C++ General user innput possible ?? Visual C++
Base 64 Encoding and Decoding Don't use casts just to get something to compile because you are likely to have prblems such as this. Tag: Visual C++ General user innput possible ?? Visual C++
Problem getting a resource TilakGopi wrote:
Hi,
One thing is creating the dlg on stack won't show u the dialog as it will be immediately destroyed when the control goes out of scope.So,create the dialog on heap(using pointers) and then show it.
In my sample i didn't get any problem.Could u please post the code completely , so that i can found the problem.
And alow which IDE u r using (VC6.0,VS2003 or VS2005)
Thanx,
Ch.T.Gopi Kumar.
I'm using VS2005., and here's the code sample.
http://theand.net/myTest_MFC.zip
I haven't set the options for Release version, so I recommand you to compile it in Debug version.
I'd be very very grateful if you could check the actual code for me, and thanks for your reply :-)
Oh, the reason I didn't create the dialog on heap was because I was afraid when the process terminates, memory leak would occur.
And when I've followed the function call which made the termination, I found out it was before the code goes out of scope.
Thanks again! Tag: Visual C++ General user innput possible ?? Visual C++
Question on Automating Word Passing Parameters Sahir Shah wrote:
Starting Word with -a switch does not prevent add-ins it just starts Word without the add-ins. You can do the same thing using automation by iterating though the Application object's AddIns collection and calling delete on each AddIn object.
Assuming that use of the "-a" parameter is what is needed, regardless of what it does, then is it easier to use automation instead than to use ShellExecute or CreateProcess Tag: Visual C++ General user innput possible ?? Visual C++
Creating CoClass in ATL using VS 2005 Hi All,
I recently started working in VS2005 environment, and having a background of VC6.0. I just created a smple ATL application under 2005, and just wondering if any option is available in the IDE for creating a coclass of the ATL component, as we does in VC6.0 IDE by using Insert->New ATL Object Please help me on the same. Thanks in advance.
Regards,
Abhinav Tag: Visual C++ General user innput possible ?? Visual C++
Forms drawing order I handled it this way:
Code Snippet
private: System::Void Form1_Activated(System::Object^ sender, System::EventArgs^ e) { if (formInfo->TopMost != true) formInfo->TopMost = true; } private: System::Void Form1_Deactivate(System::Object^ sender, System::EventArgs^ e) { if (formInfo->TopMost != false) formInfo->TopMost = false; } Those conditions are needed. Without them it just behaves improperly - check. It is also worth looking at BringToFront() method. Tag: Visual C++ General user innput possible ?? Visual C++
TrackMouseEvent Where do I put the TrackMouseEvent function if I want one of my child windows to get the hover message Does it go in WinMain() or in the WndProc() function of the child window Tag: Visual C++ General user innput possible ?? Visual C++
executing a program Hi Fighter92,
Did i get ur problem correctly and give u the right solution
If not , could u post the question bit elaborated once again
Thanx,
Ch.T.Gopi Kumar. Tag: Visual C++ General user innput possible ?? Visual C++
reinterpret_cast Hi
agian!
I have this code now, I was using ifstream, but it was well over my head, didn't understand it. But what I'd like to do with this code is get the buf to read in 64 bits (8bytes), which is does. But I would like to output the decmial value of that interger. However it seem just to but the 8 bytes back into the txt file.
How do I get it to print of the number from the buffer
the interger being displayed by value Oneline, is not correct. I can't figure out what it is doing
Eventually I'll get this program to read in a whole file, I was thinking of 8byte at a time, and print it off to a file. Using a while(!eof) statement, please would you let me know if that's not possible
#include <stdio.h>
#include <stdlib.h>
int main( void )
{
unsigned __int64 Oneline;
char buf[ 8];
int index;
FILE *fptr;
if (( fptr = fopen ( "test.jpg" , "rb" ) ) == NULL ){
printf ( "Cannot open file\n" );
exit ( 1 );
}
fread ( buf, 1, sizeof (buf), fptr );
fclose ( fptr );
if (( fptr = fopen ( "Kounter-report31.txt" , "w+" ) ) == NULL ) {
printf ( "Cannot open file\n" );
exit ( 1 );
}
fprintf(fptr, "%I64u\n" ,Oneline);
fwrite ( buf, 1, sizeof (buf), fptr );
fclose ( fptr );
}
Thanking you kindly for you time
James Tag: Visual C++ General user innput possible ?? Visual C++
VC 8.0 recompile some dlls everytime Hi, Our company just migrated our VC 6.0 projects to VC 8.0. Sometimes, when I modified the code on some dlls and recompile everything. Everytime I try to run the program, the compiler will ask me to recompile some dlls again. It happens everytime and it's pretty annoying. Does anyone have this kind of problem Any suggestion Thanks --Chung Tag: Visual C++ General user innput possible ?? Visual C++
dcom error after removing windows 2003 server sp2 patch Hi all,
i have an application working fine, until I installed windows 2003 server sp2 patch.
This application is using dcoms in a no domain to communicate with another application.
On checking the event viewer,
I encountered this error:
DCOM got error "The service cannot be started, either because it is disabled or because it has no enabled devices associated with it. " attempting to start the service ImapiService with arguments "-Service" in order to run the server: {520CCA63-51A5-11D3-9144-00104BA11C5E}
How do I solve this error
I had tried to go Add/Remove Program and removing sp2 from there but to no avail.
It seems that removing sp2 like that does not do the trick.
I forgot to make a backup copy unfortunately and am desperate for an answer.
Thanks for any help,
Atiz Tag: Visual C++ General user innput possible ?? Visual C++
Find And Replace Regular Expressions Hi !
I'm trying to use the "Find And Replace" to add the _T macro to all my strings (except
the ones already have this macro)
The regex i used to find the relevant strings is:
~(_T\(){"[^"]*"}
From some resone it doesn't work, my first try was
~(\#include |_T\(){"[^"]*"}
that also exclude all the include statements but i won't be so greedy :)
Hope someone can help me because i have many many files to edit... Tag: Visual C++ General user innput possible ?? Visual C++
Using GetFileTime and SetFileTime Hi,
I need to reset file creation and read it immediately. I have written the code as shown below
if (SetFileTime(hfile, &fts, (LPFILETIME) NULL, (LPFILETIME) NULL)) FlushFileBuffers (hfile); if (GetFileTime(hfile,&ftg, (LPFILETIME) NULL, (LPFILETIME) NULL))
Now both this fts and ftg should be same. MSDN is giving remarks saying that across all file systems behavior may not be the same.
Please help in creating this code which should work from windows 98 to windows vista. Tag: Visual C++ General user innput possible ?? Visual C++
CreateObjrefMoniker and DisplayName only good for one call to GetObject? I'm doing the following
LPMONIKER pMkr = NULL;
HRESULT hr = CreateObjrefMoniker(pUnk, &pMkr);
LPBC pBctx = NULL; hr = CreateBindCtx(0, &pBctx); LPOLESTR displayName; hr = pMkr->GetDisplayName(pBctx, NULL, &displayName);
and then passing the displayName over to a VBA macro in an instance of Excel I am automatting where
I call GetObject(displayName) to get a reference to my object and it works fine the first time but the second time it fails with "Object not registered" 0x800401fb (even though the object is still valid and up and running). This behavior is not documented (that I can find) and so I'm wondering is this the correct behavior or have I done something wrong Tag: Visual C++ General user innput possible ?? Visual C++
how to run a function that returns non-void values on a new thread? The problem with your code is that you are simply spawning a thread and asking it to put some return value. You can't make sure that the value has been updated to the pointer because these threads are different entities. You should synchronize your thread execution by using Wait functions (WaitForSingleObject etc..). If both of your threads acecssing the same data,, you may need to put some locks to synchronize the access. I've not that much used with MFC thread classes, but withe native CreateThread and other realted functions. I think the error you are getting because of the calling convention problem. You can see a bunch of articles in codeproject or some other your facorite website. MSDN also has a well documentations on same. I think you learn yourself than we explain about threads and synchronization http://www.codeproject.com/threads/ Tag: Visual C++ General user innput possible ?? Visual C++
Member function pointers johnr's idea is fairly close to a good one.
When you override the button you add a new member function and member variable.
void CMyButton: etPointer(MYPTR* mPtr);
MYPTR* CMyButton::myptr;
The MYPTR is a function pointer to the function you want called.
typedef void (MYPTR*)(/*Params*/);
(I apologise if the above typedef is not correct since I don't have access to all my references right now)
Once you have this then you set myptr with the SetPointer method and then you override the OnButtonDown method calling the myptr function pointer.
myptr(/*params*/);
Maybe a look into pointer to members too would be a good idea.
johnr:
It is true that native C++ doesn't have delegates but they have function pointers so the basic ideas can still work. Delegates are really type checked functio pointers anyway. Tag: Visual C++ General user innput possible ?? Visual C++
ReadFile() doesnt read the entire file "fread automatically checks for EOF and stops if it encounters one but for ifstream, we need to check it"
Actually ifstream checks for EOF too. If you try to read from ifstream after the EOF character it won't work. In fact ifstream uses fopen/fread/fwrite/fclose under cover so it inherits the same behavior.
If you don't want this to happen (stop at EOF) you need to open the file in binary mode:
fopen("d:\\test.bin", "rb");
or
ifstream s("d:\\test.bin", ios_base::binary | ios_base::read);
As for ReadFile it does not process EOF or any other special characters. It's the fread function that does this. Tag: Visual C++ General user innput possible ?? Visual C++
Anon4ymous12345
Hi !
Is user input possible in visual c++ eg: in my window which is created with msghandler, i would like to ask the user to enter a number & this i would like to save into my data set... is it possible