|
Have you experimented with GetAdaptersInfo() , GetInterfaceInfo() , GetAdaptersAddresses() , GetNumberOfInterfaces() , etc?
"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
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
I tried but only able to get MAC address. not understand to get IP address and not able to find active network .
Trioum
|
|
|
|
|
trioum wrote: not understand to get IP address and not able to find active network .
How about showing the code you used for this?
"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
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
DWORD destRedColor = 0;
DWORD destBlueColor = 0;
DWORD destGreenColor = 0;
DWORD destAlphaColor = 0;
DWORD SrcRedColor = 0;
DWORD SrcBlueColor = 0;
DWORD SrcGreenColor = 0;
DWORD SrcAlphaColor = 0;
int src_const_alpha = 0;
for ( int i = ( ( bm.bmWidth * bm.bmHeight ) - 1 ); i >= 0; --i )
{
COLORREF clrRef = ptPixels[i];
clrRef = COLORREF2RGB( clrRef );
DWORD redDest = GetRValue( clrRef );
DWORD greenDest = GetGValue( clrRef);
DWORD blueDest = GetBValue( clrRef);
BYTE *ptrAlphaDest = reinterpret_cast<BYTE*>( &clrRef );
DWORD alphaDest;
alphaDest = ptrAlphaDest[0];
DWORD redSrc = GetRValue( _cNewColor );
DWORD greensrc = GetGValue( _cNewColor );
DWORD blueSrc = GetBValue( _cNewColor );
BYTE *ptrAlphaSrc = reinterpret_cast<BYTE*>( &_cNewColor );
DWORD alphaSrc;
alphaSrc = ptrAlphaSrc[0];
src_const_alpha = int( m_intensity * 2.55 );
SrcRedColor = redSrc * src_const_alpha / 255.0;
SrcGreenColor = greensrc * src_const_alpha / 255.0;
SrcBlueColor = blueSrc * src_const_alpha / 255.0;
SrcAlphaColor = alphaSrc * src_const_alpha / 255.0;
destRedColor = SrcRedColor + ( 1 - SrcAlphaColor ) * redDest;
destGreenColor = SrcGreenColor + ( 1 - SrcAlphaColor ) * greenDest;
destBlueColor = SrcBlueColor + ( 1 - SrcAlphaColor ) * blueDest;
destAlphaColor = SrcAlphaColor + ( 1 - SrcAlphaColor ) * alphaDest;
ptPixels[i]
= (destAlphaColor << 24 ) |
(destRedColor << 16 ) |
(destGreenColor << 8 ) |
(destBlueColor);
}
|
|
|
|
|
I expect there is a question in here somewhere but I can't quite see it.
I must get a clever new signature for 2011.
|
|
|
|
|
Perhaps elaborate on what you are trying to do so that we can help you better.
Also note that Bitmap pictures pad each scanline to a multiple of 4 bytes.
If your bitmaps are 32bit, then you can ignore this.
That is if your picture is 5 pixels wide, each pixel taking 3 bytes (24 bits) then each scanline would be 5 * 3 = 15bytes wide.
Since that is not a multiple of 4 some bytes (1 in this case) are added to align the next scanline.
Note: The MSDN page for BITMAP[^] says they are WORD (2 byte) aligned, but from previous experience I have found that they are DWORD (4 byte) aligned.
This means that you must iterate through bm.bmHeight , and then for each iteration of that, iterate through bm.bmWidth .
BYTE *pBitmapData = (BYTE *)XXX;
int nBytesPerPixel = bm.bmBitsPixel / 8;
for (int y = 0; y < bm.bmHeight; ++y) {
for (int x = 0; x < bm.bmWidth; ++x) {
COLORREF clrRef = *((COLORREF *)pBitmapData);
pBitmapData += nBytesPerPixel;
}
pBitmapData += (nBytesPerPixel * bm.bmHeight + 3) & 3;
}
|
|
|
|
|
Actually there is one Picture In Picture( PIP ) module in the application. There is a shadow functionality is available with masking for the front layer. My mask( like heart shape ) is a bitmap file ( of 32 bpp ) which is put in the place of front layer( picture ). It's shadow looks like the same.
We can give shadow color of my choice as well( it is a provision ). Shadow will have selected color. So as it should be shown a transparent look I have used AlphaBlend() function to show transparent and semi-transparent pixels present in mask bitmap.
For the BLENDFUNCTION structure( m_blendfunc ) I given at Initialization
m_blendfunc.BlendOp = AC_SRC_OVER;
m_blendfunc.BlendFlags = 0;
m_blendfunc.SourceConstantAlpha = 0;
m_blendfunc.AlphaFormat = AC_SRC_ALPHA;
We can change the intensity of shadow as well( it's a provision ). It's rage from 0 to 100.
So that In OnPaint() I have changed the SCA value as per intenisty value.
m_blendfunc.SourceConstantAlpha = int( m_intensity * 2.55 );
As per the MSDN I have taken the red, green, blue and alpha value from Source( mask bitmap ) and mix up with destination colors ( of selected shadow color ) by this type of calculation
Src.Red = Src.Red * SourceConstantAlpha / 255.0;
Src.Green = Src.Green * SourceConstantAlpha / 255.0;
Src.Blue = Src.Blue * SourceConstantAlpha / 255.0;
Src.Alpha = Src.Alpha * SourceConstantAlpha / 255.0;
Dst.Red = Src.Red + (1 - Src.Alpha) * Dst.Red
Dst.Green = Src.Green + (1 - Src.Alpha) * Dst.Green
Dst.Blue = Src.Blue + (1 - Src.Alpha) * Dst.Blue
Dst.Alpha = Src.Alpha + (1 - Src.Alpha) * Dst.Alpha
The shadow is not getting proper it's look like some type of animation when I change the intesity.
Are I am making any mistake for taking source and destination colors or there is some mistake in calculation of new colors.
I have tried ur suggetsion of iterating through bitmap height & width but the result is same.
|
|
|
|
|
Hi!
How to represent Unicode strings? I want to enter e.g "UserName" in an XML file. How to represent the above string in the XML file using Unicode? I also have to read and display this string from C++ and display its Chinese and Korean representation. How to do this?
|
|
|
|
|
Unicode is merely text, you do not need to do anything special apart from ensuring that your project uses Unicode as its standard for all character based fields. To display Korean, Chinese or any other Asian language you just need to use a font in that specific language.
I must get a clever new signature for 2011.
|
|
|
|
|
Hi!
If I've a label called "label1" and its Text(Read from XML file) as "UserName",
then will the following suffice to display "UserName" in Chinese?
label1->Font = "Required Chinese Font"
|
|
|
|
|
It looks like you're confusing UNICODE issues with translation ones. You need to translate the text into Chinese, using the proper UNICODE characters.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
As Carlo notes below, you will need the word "UserName" in Chinese to start with.
I must get a clever new signature for 2011.
|
|
|
|
|
Richard MacCutchan wrote: As Carlo notes below, you will need the word "UserName" in Chinese to start with.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
You were below when I was composing my message; only after I posted did I notice ...
I must get a clever new signature for 2011.
|
|
|
|
|
(pardon).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
pix_programmer wrote: How to represent the above string in the XML file using Unicode?
For storing strings in XML file, you should best encode them as UTF-8.
pix_programmer wrote: I also have to read and display this string from C++ and display its Chinese and
Korean representation.
By "display" I guess you mean using Win32 API. In that case, you'll need to convert the text you read from the XML file from UTF-8 to UTF-16, set a font that supports the script your text belongs to and draw it on the screen.
|
|
|
|
|
Hi All,
i am working on dialog based application,here on the main dialog box on the button click i open the child dialog and perform some action in thread here for reading excel file using excel automation and put the values in list ctrl of main dialog box and after reading i m trying to close chile dialog so i m using EndDialog but here the exception occur.
Unhandled exception at 0x76dc8834 in test.exe: 0xC0000005: Access violation writing location 0x00000018.
please help me how can i resolve this thanks in advance.
|
|
|
|
|
How are you creating the child dialog?
EndDialog is used to destroy a modal dialog.
Here is an excerpt from the documentation -
Dialog boxes created by the DialogBox, DialogBoxParam, DialogBoxIndirect, and DialogBoxIndirectParam functions must be destroyed using the EndDialog function. An application calls EndDialog from within the dialog box procedure; the function must not be used for any other purpose.
|
|
|
|
|
yes its a modal dialog box,and i simply open this using DoModal() and on this dialog box create a worker thread to read excel and at the end of thread use EndDialog to close the child dialog.
|
|
|
|
|
The documentation says that you must call EndDialog from within the dialog box procedure.
In the case of MFC, you must call it from within the dialog class.
Are you doing this?
|
|
|
|
|
The worker thread is in child dialog class.
|
|
|
|
|
so as «_Superman_» suggested, you should not call EndDialog from other threads. Use PostMessage to send some user defined messages to your child dialog and call EndDialog() from that message handler.
|
|
|
|
|
|
Slightly off topic, but what is the child dialog doing while the secondary thread is reading the Excel file?
"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
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
its not a secondary thread the thread is inside of child dialog box and when thread the excel file and insert the value in listctrl of main dialog,this time the child dialog box is in hidden form and after the ending of file reading i pass the command to end the child dialog.
|
|
|
|