|
I got it working with the bitmap file with the return handle:
CString file_name = "c:\\gis\\aspjpeg\\file_new.bmp";
m_hBitmap = (HBITMAP)LoadImage(NULL, file_name, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
DWORD error = GetLastError();
However, it the handle is NULL when loading a JPEG file:
CString file_name = "c:\\gis\\aspjpeg\\root.jpeg";
// CString file_name = "c:\\gis\\aspjpeg\\file_new.bmp"; //line #1
m_hBitmap = (HBITMAP)LoadImage(NULL, file_name, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE);
DWORD error = GetLastError();
Do you know how to load a JPEG file into the picture control?
Elizabeth
|
|
|
|
|
ElizabethC wrote:
Do you know how to load a JPEG file into the picture control?
Use GDIPlus::Bitmap class
Use IPicture and ::OleLoadPicture() or OleLoadPicturePath() functions.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
ElizabethC wrote:
However, it the handle is NULL when loading a JPEG file:
Maybe it's not designed to work with non-BMP images.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
hey people can any of you kind folks help me to run a program every time a pc start-up winxp.
OR
when the pc connects to the net
i am using it in a console program (yeah dos)
thanx
thanx
h43k4z
|
|
|
|
|
Put an entry in the registry under:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
|
|
|
|
|
anyone here want to team up with a kool h43k3r to creat something k00l let me know kentaylorgy@hotmail.com
c++/batch/html only ................ cause that is what i kinda know
ooh i'm new here you people keep your eye on my name some kool sh1t komming
h43k4z
|
|
|
|
|
What is a "kool h43k3r" and a "h43k4z"?
Are you from Code Guru?
|
|
|
|
|
h43k3r = hacker
h43k4z = hackerz
I may be slightly off, not knowing gang-related terms and such.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
DavidCrow wrote:
h43k3r = hacker
h43k4z = hackerz
I guessed that at first, but it just didn't seem right to me since he used a "3" for both the letter "C" and the letter "E". And then in the other cool word, the letters are different.
I guess I'm not cool enough.
|
|
|
|
|
|
I have a file with the RGB values for 64 colors. This needs to be interpolated to 256 colors linearly. I dont think I am googling efficiently. I'd appreciate any references or links to informative sites. These look like:
..............
38.0000 0.8990 0.4660 0
39.0000 0.9060 0.4820 0
40.0000 0.9120 0.4980 0
41.0000 0.9190 0.5130 0
42.0000 0.9250 0.5290 0
43.0000 0.9310 0.5470 0
44.0000 0.9360 0.5650 0
45.0000 0.9420 0.5830 0
..............
Thanks,
ns
|
|
|
|
|
First of all, are you sure your color values are as small as 0.8990? What is the range these values are supposed to be in? The standard is 0-255, so basically looks like your G and B values are all of them 0 or 1 when rounded off.
Secondly, your question depends on what you mean by interpolate linearly. If you mean segment wise, then this is probably what you're after (warning, not tested):
RGBQUAD array_src[64];
RGBQUAD array_dst[256];
void interpolate()
{
for(int i=0;i<252;++i){
int j=i/4;
int m=i%4;
array_dst[i].rgbBlue=(BYTE)((double)(array_src[j])*(4-m)/4+(double)(array_src[j+1])*m/4);
}
array_dst[252]=array_dst[253]=array_dst[254]=array_dst[255]=array_src[63];
} Hope this helps.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks. I have confused myself ..... the values are actually not RGB values but way points. So to get the actual RGB from this I am thinking I need to do int(redWayPoint*255) etc (I think). After that I'll apply your code -- I once did a linear interpolation of 4 waypoints (x axis is the color index, y axis is the RGB value) but I just did it in 4 if blocks but of course your looping is the proper way and I am able to understand what you are doing!
Many thanks!
ns
Happy thanksgiving next week!
|
|
|
|
|
Hi
I have a project where I included a security which generated a key depending on the MAC-address of your network card.
This seems to work very well, except on Windows95. (I don't get it why people still use that OS .. but anyways, i need this to be fixed)
I use the IPHLPAPI.DLL (IpHelper API) for getting that Mac-Address.
In Windows95 that file could not be found. So i moved my IPHLPAPI.DLL (from Win2k computer) to the other computer and restarted the program. It said that the Win95 OS is too old for that kind of file(need to upgrade OS)
Anyone have a IPHLPAPI.DLL file of Win95 or knows how to get a correct version of the file?
I would GREATLY appreciate any help on this urgent problem.
Thanks for the efforts
Jens
|
|
|
|
|
Anonymous wrote:
Anyone have a IPHLPAPI.DLL file of Win95 or knows how to get a correct version of the file?
According to MSDN
The IP Helper API is supported on Microsoft® Windows® 98, Microsoft Windows Millennium Edition, on Microsoft Windows NT® version 4.0 with Service Pack 4, Microsoft Windows 2000, Microsoft Windows XP and Microsoft Windows Server 2003 family. Not all operating systems support all functions. If an IP Helper function is called on a platform that does not support the function, ERROR_NOT_SUPPORTED is returned. For more specific information about which operating systems support a particular function, refer to the Requirements sections in the documentation.
It looks like you'll have to find another method on Win95.
Maybe HOWTO: Get the MAC Address for an Ethernet Adapter[^] will help.
Michael
'Logic, my dear Zoe, merely enables one to be wrong with authority.' - The Doctor: The Wheel in Space
|
|
|
|
|
Hi
First, thanks for the fast response.
|
|
|
|
|
Hi
First, thanks for the fast response.
I would have thought I received 'ERROR_NOT_SUPPORTED' error back on a OS that doesn't support the API function .
I used this code to get the MAC-address:
IP_ADAPTER_INFO AdapterInfo[4]; // Allocate space for 4 NIC's
CString strMacAdres("");
DWORD dwBufLen = sizeof(AdapterInfo);
DWORD dwStatus = GetAdaptersInfo(AdapterInfo, &dwBufLen);
if ( dwStatus == ERROR_SUCCESS)
{
PIP_ADAPTER_INFO pAdapterInfo = AdapterInfo;
strMacAdres.Format("%02X-%02X-%02X-%02X-%02X-%02X",pAdapterInfo->Address[0],pAdapterInfo->Address[1],pAdapterInfo->Address[2],pAdapterInfo->Address[3],pAdapterInfo->Address[4],pAdapterInfo->Address[5]);
}
any ideas?
greetings
Jens
|
|
|
|
|
Anonymous wrote:
any ideas?
Can you use the Netbios() function that Michael suggested?
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Doesn't work on WinXP that netbios() function.
|
|
|
|
|
The thing is ... If i have a correct DLL version of that file, i can put it on the system. If it returns an error executing the program (not supported error) that it can't get the MAC-address, that's fine by me. I catch all errors but the file has to be present in the OS.
Please anyone any ideas? I am really in a big hurry to get this right
Best Regardings
Jens
|
|
|
|
|
MSDN indicates that the file ships with Internet Explorer. That should make it easier to obtain.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I think I found a bug in the MFC 7.1.
There is an error during assignment of a LPWSTR to a CString in an MBCS or ANSI application.
If you have something like this
LPWSTR pWStr; // contains an WideString
CString str;
str = pWStr; // <- here is the bug
In the third line the following member of CString is called:
CStringT& operator=( PCYSTR pszSrc ) [cstringt.h, line 988]
which calls GetBaseTypeLength [cstringt.h, line 429]
This member returns the size of the pWStr (via WideCharToMultiByte) - 1. That means that the terminating NULL-character is not counted.
So the reserved memory is too small to contain the whole pWStr including terminating NULL!
In the following call of StringTraits::ConvertToBaseType( pszBuffer, nDestLength, pszSrc ) in line 995 the destLengh doesn't include the NULL character. But ConvertToBaseType implicitly calls WideCharToMultiByte with the following parameters:
::WideCharToMultiByte( _AtlGetConversionACP(), 0, pszSrc, -1, pszDest, nDestLength, NULL, NULL );
This function returns the error code 0, because the reserved memory in pszDest is one byte to small.
To my mind this is an error in the MFCs. I only checked this in MFC 7.1. Please tell me, if you can reproduce the problem perhaps in other MFC version, too.
Thanks in advance
Konrad
|
|
|
|
|
This isn't really a bug, just the developers leveraging how the API works.
The string will come out correctly since WideCharToMultiByte will convert characters until the destination buffer fills up.
This behavior is actually desired since the length passed for the source string may be shorter than the string. The developers could have resolved nSrcLength before making the call, but chose not to since the failure is quite irrelevant.
The terminating null is taken care off by the GetBuffer() call, which reserves space for a terminating null.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
The same code was VC6.. It causes read out of bound warning in BoundChecker & Purify, but also pretty harmless.
Also note, if you change (via WideCharToMultiByte) - 1 to (via WideCharToMultiByte) you will break ATL CComBSTR, and may be some others.
|
|
|
|
|
I want to change a program id for a com project, so it will be different with the previous version.
Just change the .rgs file? or I need to change the uuid in idl files?
thanks
woody
|
|
|
|