|
For ID value is theIDC_CONNECT CEditBox resources added associated variables m_conn
|
|
|
|
|
I am guessing here as your question is not very clear, but I think you probably need to use the GetDlgItemText() [^] function to get the text from the edit box and store it in your variable. You can do this in your DlgProc() when you handle the OK response.
I must get a clever new signature for 2011.
|
|
|
|
|
Thank you for noticing my question.I've got it.
By the way ,do you know how to paste or insert a picture here .
Because ,as you know ,a picture can speak a lot of things
|
|
|
|
|
Jokcy wrote: By the way ,do you know how to paste or insert a picture here .
I don't think you can do that directly in these forums. Most people post their pictures to a free sharing web site and post the link in their question.
I must get a clever new signature for 2011.
|
|
|
|
|
Anyway ,thank you all the same.I will make my words more easily to be understood.Because I am so poor in English.
do my best to pursue knowledge
|
|
|
|
|
You do not need to apologise for your English; most of us have no other language.
However, do try and respond as clearly as you can when people ask for more information on your questions. Most of the time they are trying to help to solve your problem, and understanding your question is the first step.
I must get a clever new signature for 2011.
|
|
|
|
|
OK.I will.Once again thank you for your advice.
|
|
|
|
|
I was browsing through the web and trying to find the method of double buffering to load an bmp image. I get all the example, except I can't seems to find anyway to actually draw the bmp file into the memhdc. to be precise I will get an example code here.
hdc_mem = CreateCompatibleDC(hDC);
bmp_mem = CreateCompatibleBitmap(hDC, 80, 25);
hdc_mem = LoadBitmap(hInst, MAKEINTRESOURCE(ID_for_BMP));
SelectObject(hdc_mem, bmp_mem);
BitBlt(hDC, 100, 50, 180, 75, hdc_mem, 0, 0, SRCCOPY);
DeleteDC (hDC);
DeleteDC (hdc_mem);
DeleteObject (bmp_button);
In the part where I should write stuff into hdc_mem, and I did LoadBitmapbut nothing is drawn on the screen. If i take the LoadBitmap line away, it will draw me a black box.
what should I do? any links for any example?
|
|
|
|
|
You code does not suggest you are attempting to double buffer but since that is the topic you stated you are trying to understand, I would suggest this article first. (Your question will be answered indirectly in there)
Flicker Free Drawing In MFC[^]
|
|
|
|
|
ahh its MFC.. please gimme some winapi/C example tyvm
|
|
|
|
|
Are you seriously trying to tell me that you can't derive the WIN32 from the simple MFC wrappers? Most C/C++ programmers could easily convert between the two since all it really encapsulates (loosely) are the handles.
You're kidding right?
|
|
|
|
|
LoadBitmap() returns a handle to a BitMap not a device cobntext, see here[^].
I must get a clever new signature for 2011.
|
|
|
|
|
Try this:
BITMAP bm = { 0 };
HBITMAP hbm = LoadBitmap(hInst, MAKEINTRESOURCE(ID_for_BMP));
if (hbm && GetObject(hbm, sizeof(BITMAP), &bm))
{
hdc_mem = CreateCompatibleDC(hDC);
SelectObject(hdc_mem, hbm);
BitBlt(hDC, 100, 50, bm.bmWidth, bm.bmHeight, hdc_mem, 0, 0, SRCCOPY);
}
|
|
|
|
|
Hey guys. How to convert gdiplus::color to dword value?
Like this:
Gdiplus::Color(255, 0, 0, 0) -> 0xff000000
Gdiplus::Color(160, 48, 197, 253) -> ???
Thanks
011011010110000101100011011010000110100101101110
0110010101110011
|
|
|
|
|
The simplest way is to use Color::MakeARGB or Color::GetValue
Be careful if you try storing the ARGB in a COLORREF as it is possible to lose the alpha under certain circumstances and not all of your fellow programmers would approve. Also, be aware that when dealing with the bits, you sometimes need to switch the R and B around , depending on the context.
|
|
|
|
|
assuming all input values are in the [0,255] range, all it takes IMO is
(((((arg0<<8) | arg1) <<8) | arg2) <<8) | arg3
which is best implemented as an unsigned integer expression (otherwise it could give an overflow under some circumstances).
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
That is basically how MakeARGB is defined (and it provides for a common code base) so I'd still recommend it when they are already using GDI+...
typedef DWORD ARGB;
enum
{
AlphaShift = 24,
RedShift = 16,
GreenShift = 8,
BlueShift = 0
};
// Assemble A, R, G, B values into a 32-bit integer
static ARGB MakeARGB(IN BYTE a,
IN BYTE r,
IN BYTE g,
IN BYTE b)
{
return (((ARGB) (b) << BlueShift) |
((ARGB) (g) << GreenShift) |
((ARGB) (r) << RedShift) |
((ARGB) (a) << AlphaShift));
}
|
|
|
|
|
Luc, Bob, thanks very much
011011010110000101100011011010000110100101101110
0110010101110011
|
|
|
|
|
hello guys... I wrote an application (which uses COM and ADO) inwhich I use the user 'sa' to do some small transactions, in Sql Server. Now when I run same program on some other computer, this programs shows some debug error saying
Debug Error !
This application has requested the Runtime to terminate in its unusual way. Please contact the applications support team for more information.
Now since I have run this small EXE on my laptop, so I know nothing is wrong with my program. But at the same time, sql server is also not faulty, I mean we just need to enable 'Mixed Mode' and enable the 'sa' user. Thats it. So what can be the problem.
|
|
|
|
|
I know this ain't helpful but seeing your program run on a particular machine means only that it runs on that particular machine, it does not mean it will run on any other machine aswell. Sadly. Maybe try Post-Mortem Debugging Your Application with Minidumps and Visual Studio .NET[^]. It is hard to guess on any reasons without seeing anything of the code, circumstances, environment and so on... you could also try adding some logging to your program to find out where it crashes.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> //TODO: Implement signature here<
|
|
|
|
|
How can I get the list of USB mass storage devices of kind "C:\, D:\" and etc, using C and WINAPI? I tried to do it with SetupDi* functions and got the friendly name and full path to device, but it isn't that needed.
#include <stdio.h>
#include <tchar.h>
#include <windows.h>
#include <setupapi.h>
#include <winioctl.h>
#pragma comment(lib, "setupapi")
int _tmain()
{
DWORD i = 0;
DWORD required_size = 0;
PSP_INTERFACE_DEVICE_DETAIL_DATA interface_details;
SP_INTERFACE_DEVICE_DATA interface_info;
HDEVINFO dev_info;
dev_info = SetupDiGetClassDevs (&GUID_DEVINTERFACE_DISK, NULL, NULL, DIGCF_PRESENT | DIGCF_DEVICEINTERFACE);
if (dev_info == INVALID_HANDLE_VALUE)
{
return EXIT_FAILURE;
}
ZeroMemory (&interface_info, sizeof (interface_info));
interface_info.cbSize = sizeof (interface_info);
for (i = 0; SetupDiEnumDeviceInterfaces (dev_info, NULL, &GUID_DEVINTERFACE_DISK, i, &interface_info); ++i)
{
SetupDiGetInterfaceDeviceDetail (dev_info, &interface_info, NULL, 0, &required_size, NULL);
interface_details = (PSP_INTERFACE_DEVICE_DETAIL_DATA) LocalAlloc (0, required_size);
interface_details->cbSize = sizeof (*interface_details);
SetupDiGetInterfaceDeviceDetail (dev_info, &interface_info, interface_details, required_size, NULL, NULL);
LocalFree (interface_details);
interface_details = NULL;
}
SetupDiDestroyDeviceInfoList (dev_info);
return EXIT_SUCCESS;
}
Can you help me with this question?
Best Regards,
Alexander S.
modified on Saturday, March 12, 2011 11:20 AM
|
|
|
|
|
What problem are you having? If interface_details->DevicePath has the full path, then all you have to do is extract the drive using something like _splitpath() .
|
|
|
|
|
interface_details->DevicePath looks like
\\?\ide#diskhitachi_hts545032b9a300_________________pb3oc64g#4&110e2cc5&0&0.0.0#
{53f56307-b6bf-11d0-94f2-00a0c91efb8b}
and there are no drive letters.
|
|
|
|
|
Hi,
I don't know the functions you are using. Here is what I have used so far:
1.
GetDriveType(string rootPathName) which is a kernel32 function. It returns one of:
Maybe that is sufficient for your needs.
2.
If not, I would have to recommend WMI; warning: it is a bit of a puzzle. The relevant WMI classes would be Win32_DiskDrive, Win32_LogicalDiskToPartition, Win32_PhysicalMedia. And IIRC the drives come in the same order when querying Win32_PhysicalMedia and Win32_DiskDrive.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Let's say I have a command-line C++ program running under an Administrator account on the system and I want to start another program but I want it to run under a different user account. I want this new user account to only have write permissions to a specific subdirectory tree on the system and restricted access to the Registry (if possible). And this account should only be able to run specific programs. I also want my C++ program to manage the list of allowed programs for the target user account.
How do I create such an account? (Windows XP Professional SP3)
Then, how do I start the target program using the desired user account?
Also, using C++ (or command-line applications I can execute from my C++ program), how do I go about managing the list of allowed programs for the target user account?
|
|
|
|
|