|
|
isn't a bmp with transparent background called png image? in the link posted by you, the sample bmp image is treating the pink color as transparent. And also the code is using gdi and not gdiplus. I would suggest you to find some sample code that uses gdiplus for drawing. gdi is outdated and the sample code is not showing the splash screen in separate thread. such a splash screen will only be shown when the initialization is already done.
Of what use is such a splash screen?
also, if your purpose is to create a splash screen, then the link is of not much use to you. If your purpose is to learn window creation, drawing, setting regions etc then you should find another article.
check this for transparent bitmap concept
for setWindowRgn demo, MFC Transparent CDialog Demo
for gdiplus Starting with GDI+[^]
&
Loading JPG & PNG resources using GDI+[^]
|
|
|
|
|
thanks a lot for your suggestion. I will do so...
-----------------------------
I am a beginner
|
|
|
|
|
See TransparentBlt[^] function, and look for the remarks for the last parameter:
....
crTransparent [in]
The RGB color in the source bitmap to treat as transparent.
....
hrishiS wrote: Now, could anyone please tell me how to create a similar picture like that with .bmp extension...
You create pictures with MS Paint or Adobe Photoshop
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Hi
How to Export Images into PDF using VC++?
is there any possible solution
Thanks !!
|
|
|
|
|
There are multiple possibilities for that:
1. Learn the PDF format and write your own code
2. Use a PDF Printer driver like CutePDF[^] and print your images
3. Get a hold on a PDF writer library like PDF Creator Pilot and use it
There might be more but these 3 come to my mind right now...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Check this article right here on CP - The Great PDF - Revealed[^]
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
LibHaru[^] comes to my mind.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
hi
i use one edit Control in my Dialog.
when i use below code for read content of it :
[code]
GetWindowTextA(hEdit,editStr,10);
[/code]
if content of Edit control is more than one Character my program give error in :
[code]
EndDialog( hDlg, FALSE );
[/code]
error:
First-chance exception at 0x7e424f4a in CreateDevice.exe: 0xC0000005: Access violation reading location 0x00003355.
Unhandled exception at 0x7e424f4a in CreateDevice.exe: 0xC0000005: Access violation reading location 0x00003355.
if i enter one Character in Edit control error dont accure.
why ?
|
|
|
|
|
1. Are you completely sure that GetWindowTextA causes the problem?
2. How did you declare editStr ?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
editStr is LPSTR and i debug it. my program get string correctly and store it on editStr but only cant do EndDialog() if string be more than one Character!
|
|
|
|
|
Please post the code extract (and remember to format it properly in <pre></pre> tags) that contains the definition and initialisation of editStr . Also what else can you see through the debugger at the EndDialog() call.
|
|
|
|
|
And what does it point at? You will have to feed GetWindowTextA with a pointer at a buffer that can hold the characters, if you do something like this:
LPSTR editString;
GetWindowTextA(hedit, editString, 10);
GetWindowText will copy the characters somewhere in memory and who knows what it overwrites -> problems. Or it crashes vith Access Violation (better case since then you know what is wrong, however if it does not crash immediately just overwrites something in the memory area of your process then it can die on anthing anywhere later and you might have no idea why...)
You could either try this:
char editString[11];
GetWindowTextA(hedit, editString, 10);
or maybe something like this:
LPSTR editString;
int len = GetWindowTextLength(hedit);
editString = new char[len + 1];
GetWindowTextA(hedit, editString, len);
...
delete []editString;
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
The Error is completly correct, you need a buffer or string to store the text, not only a pointer
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Hi All
i am reading excel row and column.I read successfully but i got error when excel cell values like this "12:10:59" i mean time format.I am reading like this
[code]
_variant_t vItem = pRange->Item[ iRow ][ iCol ];
_bstr_t bstrText( vItem );
[/code]
Plz help me
modified on Wednesday, September 30, 2009 3:01 AM
|
|
|
|
|
Good morning
Are you sure that your cell containing a time value return a string ?
may be Excel put in your variant a type which is not compatible with a string
you may need to convert it before put in the string.
Hope this will help
Regards
Franck.
|
|
|
|
|
yes i know that my question how to convert.
|
|
|
|
|
What exactly is the problem?
You say that you are reading a string in the form "12:10:59". To convert this to a time value you need to split it into its component parts ("12", "10" and "59"), convert each substring to an integer, and then combine with a simple formula to give you the total number of seconds.
|
|
|
|
|
No my problem is this.
If i am reading "12:00:12" from excel then through this code
_variant_t vItem = pRange->Item[ 1 ][ iColumn ];
_bstr_t bstrText( vItem );
i am getting 0.500138888888889
now what i do to get "12:00:12" from excel.
|
|
|
|
|
MsmVc wrote: i am getting 0.500138888888889
This is the internal Excel date and time format. I cannot remember the exact details but I think the datetime is in the form D.S, where D is the number of days since the 'epoch'*, and S is number of seconds since midnight divided by 86,400 (the total number of seconds in a day).
So in your case to get the time we multiply 0.500138888888889 by 86,400 which gives 43,212 or 12 hours, 0 minutes and 12 seconds.
*epoch is the base date from which counting starts. I think Excel may start at year zero.
|
|
|
|
|
Thanks for nice and smart concept.But my problem is something different.
See i am getting values from Excel "0.500138888888889" this data can be Time format or double format.So how can i format this data.I think i need to identify data type of excel before format(Change).
Please help me
|
|
|
|
|
i think need to post some more code.
try
{
.
CoInitialize(NULL);
while ( m_list.DeleteColumn( 0 ) );
HRESULT hr;
CFileDialog fileDlg(TRUE, _T("xls"), NULL, OFN_PATHMUSTEXIST|OFN_OVERWRITEPROMPT,_T("Excel Files|*.xls;*.xlsx|"));
if (fileDlg.DoModal () == IDCANCEL)
return;
CString OpenFile = fileDlg.GetPathName ();
Excel::_ApplicationPtr pApplication;
if (FAILED( pApplication.CreateInstance( _T("Excel.Application") ) ) )
{
return;
}
_variant_t varOption( (long) DISP_E_PARAMNOTFOUND, VT_ERROR );
Excel::_WorkbookPtr pBook = pApplication->Workbooks->Open( (_bstr_t)OpenFile, varOption, varOption, varOption, varOption, varOption, varOption, varOption, varOption, varOption, varOption, varOption, varOption );
if ( pBook == NULL )
{
pBook->Close( VARIANT_FALSE );
pApplication->Quit( );
Errorf( _T("Failed to open Excel file!") );
return;
}
for(int i=1;i<4;i++)
{
Excel::_WorksheetPtr pSheet = pBook->Sheets->Item[ i ];
_bstr_t na=pSheet->GetName();
if ( pSheet == NULL )
{
return;
}
Excel::RangePtr pRange = pSheet->GetRange( _bstr_t( _T("A1") ), _bstr_t( _T("Z1" ) ) );
if ( pRange == NULL )
{
Errorf( _T("Failed to get header cell range( A1:iv )!") );
return;
}
int iColumns = 0;
for ( int iColumn = 1; iColumn < 26; ++iColumn )
{
_variant_t vItem = pRange->Item[ 1 ][ iColumn ];
_bstr_t bstrText( vItem );
if ( bstrText.length( ) == 0 )
break;
m_list.InsertColumn(iColumns++,bstrText,LVCFMT_LEFT,170 );
}
pRange = pSheet->GetRange( _bstr_t( _T("A2") ), _bstr_t( _T("Z16384" ) ) );
int iColumn=0;
for ( int iRow = 1; ; ++iRow )
{
for ( iColumn = 1; iColumn <= iColumns; ++iColumn )
{
_variant_t vItem = pRange->Item[ iRow ][ iColumn ];
_bstr_t bstrText( vItem );
if ( bstrText.length( ) == 0 )
break;
if ( iColumn == 1 )
m_list.InsertItem( iRow - 1, bstrText );
else
m_list.SetItemText( iRow - 1, iColumn - 1, bstrText );
}
if ( iColumn == 1 )
break;
}
for ( int iColumn = 1; iColumn <= iColumns; ++iColumn )
m_list.SetColumnWidth( iColumn, LVSCW_AUTOSIZE_USEHEADER );
}
pBook->Close( VARIANT_FALSE );
pApplication->Quit( );
}
catch(...)
{
}
Here i take some constant value so please don't make issues of constant values.
|
|
|
|
|
MsmVc wrote: I think i need to identify data type of excel before format(Change).
Yes I guess that's right. Unfortunately I cannot help with that as I am not sure how to get the information from Excel as to what type of information is held in a particular cell. I suspect that there is no way; if you write a number in an Excel cell, you can format it any way you like. However, you are the only person that knows what that number represents, all Excel knows is how you want it to be displayed on the screen!
|
|
|
|
|
|
Good morning
I agree with Richard.
You know your excel document. so if you expect to find time cells inside, you should detect that when reading it.
I think you could try to retreive from excel the cell format.
detect the date time mode and react accordingly.
if you cannot find the cell format then if i remeber well you can retreive the value of your cell as a string. in that case i would post analyze it and if something like "07:07:13" is detected i will do the tranformation for a time.
bye the way did you try to analyze the type of your read vItem to see what is in the BSTR value for a date time cell ?
Regards
FRanck.
|
|
|
|