Visual C++ :: Retrieve IP Information On Any Windows
Sep 23, 2012
I used to retrieve IP and NIC information by querying windows registry. Now I'm trying to use GetAdapterAddresses() API. Using GetAdapterAddresses() to get IP is not that easy, I need to dig a long deep as I check some examples so far, anyways my question is: Calling this API will return success on all versions of Windows ie: 32bits & 64bits ?
Though Microsoft has not opened any source, where this API is actually retrieving Windows IP information.?. Is it reading Registry or some windows file.
I created a simple program that writes some text to two different text files. how to create a program that would retrieve the information from those two files, and put them in a single file, first the content of input1 and then the content of input2. how to do this. Here is the program that I created that creates the two files.
#include <iostream> #include <fstream> #include <string> int main() { using namespace std; string input1; ofstream fout("input1.txt");
I am trying to retrieve information from a website [URL] .... and have written a C code as follows:
Code: #include <stdlib.h>#include <stdio.h> #include <string.h> #include <curl/curl.h> int main(int argc, char* argv[]) { /* Exit status to return */ int exitStatus = 0;
[Code] .....
The output of this program should be: From To 4504111 B0LPF3 4504111 P62993
The first print option [printf("%s", url)] gives the url output as [URL] .... which on being manually pasted in any web-browser gives the correct output but the program fails to give the output.
When I use SHBrowseForFolder I can retrieve a PIDL of the selected folder and with this PIDL I can get the path with SHGetPathFromIDList.
Now, given a path to a folder, I want to retrieve its PIDL. How can I do it? I tried SHParseDisplayName() but seems that function is unsupported in VC++ 6.0
I have used the following code to attempt to place a binary array into and then retrieve from the Registry. I am a member of the local Administrator group. I have verified that the Registry for the app has a binary array 32 bytes in length under the key "settings" / "keyb" ab 12 cd ...
Code: // in header unsigned char m_key[32]; int m_nKeySize; // in implementation // int ctor AfxGetApp()->GetProfileBinary(_T("settings"), _T("keyb"), (LPBYTE*)&m_key, (UINT*)&m_nKeySize); // in OnDestroy AfxGetApp()->WriteProfileBinary(_T("settings"), _T("keyb"), (LPBYTE)&m_key, m_nKeySize );
Here is a copy of the binary array in the Registry:
7D DE 2B 30 E7 06 12 AC 99 60 8C 26 21 FC 8E 5B 66 DB 72 9E A2 00 BE 15 E1 8B 67 31 E5 EC 8B 15
Here is the binary key retrieved from the Registry using the code above:
D0 EB 26 00 CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC CC
And then the Calculator is shown in domainuser1 desktop, but the process is running in domainuser2 account.
When running Spy++ (either wither domainuser1 or domainuser2) to view the calculator window, the Windoe Proc field is shown 'Unavailable' I also try to call GetWindowLong against this window, it will always returns NULL.
I am just wondering if it is possible to retrieve the Window Proc of the window running in a process of another account, is is possible?
Trying to get table indexes information in SQL Server 2012 I identified a strange situation for one scenarion.I have a table that contains two indexes referenced to some fields: Field_1 and Field_3 mapped over int, null columns (the number means the existing field order into the table designed few years ago...).
I am trying to get information about these indexes like this:
Becasuse SQLExtendedFetch() is deprecated I used SQLFetchScroll() but the behavior is the same from my interest point of view.
Usally, I get the right information about indexes but in one situation I encounte a strange behavior. It's about having a clustered index into a scenario. When Field_1 is Non-Unique, Non-Clustered and Field_3 is Clusted index I get the right information.
But if the index Field_1 is Clustered and the Field_3 is Non-Unique, Non-Clustered I get no information about Field_1 index (eg. szIdxName and szIdxColName are "" and their length is -1 that means SQL_NULL_DATA). So, I have no Index information. Within while loop, with the next iteration I get correct information about the second index Field_3.
I'm not sure whether the problem is with SQLStatistics, the bindings or SQLFetchScroll (they all always return SQL_SUCCESS). It looks like a problem with the driver when the first index is clustered.
i changed my code from release to debug mode. when i try to debug it shows a dialog box that '... does not contain debug information press ok to continue"..
I am struggling to find a replacement of NtQuerySystemInformation call for 64-bit Windows OS, like on Windows Server 2008 (64-bit). Need getting overall CPU utilization (average) over all CPU cores?
I used to use OutputDebugString, and not using it now because it only allows to strings to be outputted, are there any methods that I can dump virtually anything to the console?
cout << thing << endl;
But what if I am not start running the program from the command prompt?
I am writing a program that grabs information from a .dat file. I have the code all structured up, but I get these 2 errors that does not make any sense to me on how to fix the program.
errors (2):
Code: Error1error LNK2019: unresolved external symbol "void __cdecl swap(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > *,class std::basic_string<char,struct std::char_traits<char>, class std::allocator<char> > *)"
Basically the question is to develop an application that allows: Create an application which stores information about people, along with a task list.
The user should be able to Store people's information
Name, Age, Telephone number, Address
-Retrieve information by entering name - Remove a person's record by entering their name -Return records for all people, sorted according to an information type other than age -Enter a task which needs doing, a priority entered for its urgency -View highest priority task on the list -User should be able to remove highest priority item on the list
How to develop this application on a console command line interface style or any other style.
How to get this thing to work. All i need to do is ask user to input a name and then it brings out the line from the .txt file containing the information.
For example in my case I'm doing a member search function I'm required to ask user to input the name of the customer and then print out all the details (which consumes 1 text line in the .txt file)
Here is the code, This is the write to text file method (100% working)
I've just integrated the Windows SDK V7.0A into my VS2005 application, and I'm getting the dreaded "Application configuration error" when I try to run it on an XP machine.
It runs fine on the development machine, and some customer machines (Win7 and Win8), but will not run on XP due to missing/incorrect version dlls.
I've rebuilt all my libraries, but still no joy.
So, my first question is - If I upgrade the Windows SDK to V7.0A, do I also need to use MFC 10 and msvcrt10, or can I stick with MFC 8?
The next question is, how do I find out which dlls are missing, and which libraries or other dlls are requesting the missing versions?
In my application I have some type of windows showed in an instance of time, and an action shows a new one that i want have the focus all the time , in the way that i can't works with no one of the others. They all are windows, child windows an modeless dialogs, but i don't know how to do. I try use EnableWindow(FALSE) that all the others windows and dialogs, but not works.
I am new in Visual C++ and I have to make an MFC application with "child" windows. Here is what i need to achieve - [URL] ..... As you can observe when you click on the cross of popup window or child window 2 both are closing.
I designed an app for work that lets you enter data in a much more efficient way, then it needs to paste this data into the very curmudgeonly interface we use for work. I designed this app a long time ago while at a different company, and I used VC++ 6. I'm still using VC++ 6, but in a vbox with windows XP.
The code is being called as part of a bigger function that determines what exactly needs to be pasted into the work app spreadsheet. I have to call each item separately because the work app does not take copied tabs the way Excel would or whatever, it just ignores them. And it also pops up boxes and such that need to be handled in other ways.
The result works just fine under Windows XP, but when I do it under my regular Win7 box or on the Win7 boxes at work, it does not work properly.
This sets the data up, Text being the data to be pasted:
Code: while (1) { if (OpenClipboard() == FALSE) { ::Sleep(1); continue; } HGLOBAL clipbuffer; char * buffer; EmptyClipboard();
[Code] ....
No infinite loops yet, again was just testing if it was OpenClipboard failing because it was being called again too quickly or something (and it did happen occasionally).
Then testing that the clipboard data is correct (this is always true), and pasting with keybd_event. SendInput is not available with VC++ 6.
If the ::Sleeps are commented out, it will paste the wrong data almost every time under win7. It seems like it pretty much uses the last thing to be copied in the function and pastes it over and over (but not *always*). If I uncomment them, it will work as expected, but it obviously takes longer. With ::Sleep(50), it works about 80-90% of the time. Obviously I can't have the wrong data being pasted, and I'd prefer not to have to wait like this--and perhaps on a slower system or a system that is doing other things it may take longer and paste the wrong thing. It works fine on XP even without the sleeps.
Did keybd_event become a separate thread or something? Am I doing something wrong with the buffers? (I've tried using CSharedFile too with GMEM_MOVEABLE | GMEM_SHARE | GMEM_ZEROINIT settings, exact same thing.) Why does it work fine under XP but not under 7?
The following code it taken from msdn library but it is failing to compile.
the following code has a header where all the variables used here are stored in header App.h.
The following lines are giving trouble:
Code: DialogBox(pApp->getInstance(), MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, pApp->About); error: 'App::About': function call missing argument list; use '&App::About' to create a pointer to member
Code: wcex.lpfnWndProc= &App::WndProc; error: '=' : cannot convert from 'LRESULT (__stdcall App::* )(HWND,UINT,WPARAM,LPARAM)' to 'WNDPROC'
There is no context in which this conversion is possible