|
HI All,
I have drawn an image using GDI+. I want a rectangle in the middle of image and alpha blending on remaining part of image.
I got stuck and want idae from yourside. please guide to do that.
|
|
|
|
|
Here is a nice article with example that might help.
Alpha Blending using GDI+[^]
PURPOSE: Delays program execution until designated condition is indicated.
|
|
|
|
|
Hi friends, here is my query...
I am working on win32. I am writing an application to read some data from registry. It is working on 32 bit machines. But it is not working on 64 bit machines. I am using the below API to read the data.
RegQueryValueEx(hKey, pszEntry, NULL, NULL, (LPBYTE)pData, 200)
Is there any problem with the last parameter size (200). What size to be passed as parameter.
Thanks in advance.
Regards
Sairam M.
|
|
|
|
|
msr_codeproject wrote: Is there any problem with the last parameter size (200). What size to be passed as parameter.
This parameter should be the address of (pointer to) a variable that contains the length of the buffer, as described here[^]. If this size is not large enough for the result then the call will fail and the required size will be entered into the variable. Thus if you make a call with the variable set to zero you can find out how big the buffer needs to be and allocate as appropriate.
BTW I'm not sure why your question got downvoted so I have upped it to compensate.
It's time for a new signature.
|
|
|
|
|
The strange thing is that your code actually worked in the 32 bit edition. Any call to RegQueryValueEx using your parameters would result in an attempt to write something at memory address 200. Not good.
|
|
|
|
|
Mattias G wrote: The strange thing is that your code actually worked
Firstly, that was the OP's code, not mine.
Secondly, I don't think it did work correctly.
It's time for a new signature.
|
|
|
|
|
Right, "your" was referring to the OP, naturally. Could have been more clear on that 
|
|
|
|
|
What I meant was you should have posted your reply to the OP, not to me.
It's time for a new signature.
|
|
|
|
|
Hi Guys, my trails are not working. I am giving you the path of the key. Please write small code to read it.
Key Path:
HKEY_CURRENT_USER\Software\ABCD\ABCD UD PCL6_00-00-00-00-00-00\printer_ui\icc_profile\0
Name of the filed: szResId
Type of the field: REG_DWORD
Data at the field: 0x000084d6(34006)
Now I want to read 0x000084d6. I tried in so many ways. But it wasn't worked. Help me.
Regards
msr_codeproject
|
|
|
|
|
msr_codeproject wrote: I tried in so many ways. But it wasn't worked. Help me.
Show the code you've tried so far.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Try the following:
static PWSTR pszKeyName = L"Software\\ABCD\\ABCD UD PCL6_00-00-00-00-00-00\\printer_ui\\icc_profile";
LONG lResult;
HKEY hkMyKey;
DWORD dwDisposition;
DWORD dwType;
DWORD dwData;
DWORD dwSize;
lResult = RegCreateKeyEx(HKEY_CURRENT_USER,
pszKeyName,
0,
NULL,
0,
KEY_READ,
NULL,
&hkMyKey,
&dwDisposition
);
if (ERROR_SUCCESS == lResult)
{
dwSize = sizeof dwData;
lResult = RegGetValue(hkMyKey,
L"0",
L"szResId",
RRF_RT_ANY,
&dwType,
&dwData,
&dwSize
);
}
Note: this is a Win32 solution, I don't have access to a 64-bit system.
It's time for a new signature.
|
|
|
|
|
Richard MacCutchan wrote: static PWSTR pszKeyName = L"Software\\ABCD\\ABCD UD PCL6_00-00-00-00-00-00\\printer_ui\\icc_profile";
I think you should make pszKeyName constant (i.e. static LPCWSTR), considering you're referencing it to memory (the string literal) that could be read-only.
|
|
|
|
|
MicroVirus wrote: I think you should make pszKeyName constant (i.e. static LPCWSTR), considering you're referencing it to memory (the string literal) that could be read-only.
This is a simple example of how to get a value from a registry key; making the keyname const will have no effect on the code I provided.
It's time for a new signature.
|
|
|
|
|
Richard MacCutchan wrote: This is a simple example of how to get a value from a registry key; making the keyname const will have no effect on the code I provided.
True, but it's still good to realise that it should be const. If someone reads your post and decides to adapt it, having it to const to begin with could be useful.
I know, I'm whining... It's just that I feel it's an overlooked detail; I forget it myself, so that's why I find it important
|
|
|
|
|
The last parameter is wrong. It needs to be a pointer to a DWORD that gives the size of the buffer, not the size of the buffer itself. Currently, your code is using the value of the memory at address 200 as the buffer size, and that could be anything...
Try:
DWORD cbSize = 200;
RegQueryValueEx(hKey, pszEntry, NULL, NULL, (LPBYTE)pData, &cbSize);
|
|
|
|
|
hello guys...im new to MFC using VS 2008.....i get the file opend but the sound file does't play, why??....here is the code im using
void CPlaySoundDlg::OnOpennplay()
{
CFile file;
char strFilter[] = {"All Files (*.*)|*.*"};
CFileDialog FileDlg(TRUE,".WAV",NULL,0,strFilter);
CString filename = _T(FileDlg.GetFileName());
CString filepath = _T(FileDlg.GetFolderPath());
if (FileDlg.DoModal()==IDOK) {
PlaySound(filepath + filename,NULL,SND_SYNC);
}
}
How can I know that which item i present in which header file...just like File Open/Save dialogs are present in afxdlgs.h??
|
|
|
|
|
Why do you query the file name and the folder separately and then concatenate them, are you sure this produces a valid path (correctly separated with backslashes)? Use CFileDialog::GetPathName[^] instead. Not to mention you are querying these strings BEFORE you display the dialog to the user, so most likely you get 2 empty strings anyways. Those Get... things will give you something usefull once the dialog has been dismissed via OK. Another thing, _T() is used on string literals, not on CString objects returned by some functions.
Muzammil Saeed wrote: How can I know that which item i present in which header file...just like File Open/Save dialogs are present in afxdlgs.h??Confused
- What do you mean by this?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
1)..As stated earlier, im new to this, next time I"ll use seggested functions i-e GetPathName().
2)..In order to use Open FileDialog / Save File Dialog, w mus incluse afxdlgs.h file (which off course is te required header file), how can I know that which header file to include b4 using something?? I mean where find header files to choose from??
|
|
|
|
|
If you have a "standard" MFC project created for you by Visual Studio then most common things like the CFileDialog you can access freely without explicitly needing to include anything because the headers for these things are included (directly or indirectly) inside stdafx.h which will be included in your cpp files anyways. If for some reason you DO need to add includes explicitly you can check MSDN[^], search for the class or method or whatever you want to use and check its documentation, also, you can google for it, e.g:
1. Google for CFileDialog[^]
2. Click the first hit (it's usually MSDN if you are looking for common MFC/Microsoft things)
3. scroll down till you see this: " Header: afxdlgs.h ", this info is mostly located around the bottom of the page, somethimes there's even a table showing you what header you need to include, what library/DLL contains the implementations, etc.
Another way is to simply hit F1 while the cursor is on what you are looking for, this should give you the documentation for it which should state the header. Also another way is to right-click what you are looking for and select "Go to declaration", if you are lucky it will bring you to the header you need to include to use the given item.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
|
Yourwelcome.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> "It doesn't work, fix it" does not qualify as a bug report. <
> Amazing what new features none of the programmers working on the project ever heard of you can learn about when reading what the marketing guys wrote about it. <
|
|
|
|
|
You should use getpathname method.
or
change code with
PlaySound(filepath +"\\"+ filename,NULL,SND_SYNC);
|
|
|
|
|
Hi all,
i m taking help of this article for printing in my application.
Another ListView print (preview) sample.[^]
but some times in 64 bit machine Print and Print Function not responding.
when i debug the code i found in OnPreparePrinting(CPrintInfo* pInfo) function DoPreparePrinting(pInfo) return false.
but this problem is resolve when i restart the machine.
please tell me how can i resolve the problem without restarting the machine.
thanks in advance.
modified on Monday, July 19, 2010 2:57 AM
|
|
|
|
|
If I open one named pipe and want to communicate both ways between client and server, how do keep the client from reading data it just wrote to the pipe? Or is the data only transfered in one direction, that that the client cannot end up reading the data it writes?
For example: Client writes a string, then assume the server reads the string, so it checks the pipes for a response, then ends up reading the string it just wrote to the pipe.
|
|
|
|
|
AFAIK it is like two uni-directional pipes, similar to a serial port communication.
|
|
|
|