|
But I think I could to show avi files without divx codec(of course Im not sure because I installed 3dmax on my system).
|
|
|
|
|
I am using CChatRichEd class derived from CRichEditCtrl downloaded from codeproject to show url as hyperlink in my RichEdit control.
Now when I click the url to open the respective url I am facing 3 problems.
1. I neew to click it twice although it should open on a single click.
2. Secondly On clicking the URL link and after the url gets openend if i look at the RichEdit control the cursor is at the position in the url where mouse was clicked and it blinks over as there as a result of which the next text appears at that position where the mouse was clicked.
I want that the the cursor should not be displayed and blink and should move to the next line after the link.
I am using the following code for opening the URL:
BOOL CChatRichEd::OnLink(NMHDR *pNotifyHeader, LRESULT *pResult)
{
ENLINK *pENLink = (ENLINK *) pNotifyHeader;
CString URL ;
CHARRANGE CharRange ;
*pResult = 0;
switch (pNotifyHeader->code)
{
case EN_LINK:
pENLink = (ENLINK *) pNotifyHeader;
switch (pENLink->msg)
{
case WM_LBUTTONDOWN:
GetSel(CharRange);
SetSel(pENLink->chrg);
URL = GetSelText();
SetSel(CharRange);
{
CWaitCursor WaitCursor;
ShellExecute(GetSafeHwnd(), _T("open"), URL, NULL, NULL, SW_SHOWNORMAL);
*pResult = 1;
}
break;
case WM_LBUTTONUP:
*pResult = 1;
break ;
}
break;
}
return 0;
}
Please help me.
Thanks
Dhiraj
|
|
|
|
|
Dhiraj kumar Saini wrote: 1. I neew to click it twice although it should open on a single click.
Based on what?
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hi People
I have read and implemented ShellExecute() from the following articles:
http://www.codeproject.com/KB/shell/csdoesshell1.aspx[^]
http://www.codeproject.com/KB/shell/shellextguide1.aspx[^]
and a few others. I managed to get the code to work and execute various .exe programs. But I am unable to load and run the standard windows Sort.exe program. I tried redirecting StdIn/StdOut, etc but to no avail.
The only way to run sort.exe would be to use ShellExecute to actually load and run a BAT file containing the required command, eg: (put the following statement into a bat file and then load/run with ShellExcute)
"C:\WINDOWS\system32\Sort.exe" < input.dat > output.dat
Has anyone any clues as to why this is so.
|
|
|
|
|
Why don't you ask in the articles' threads?
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]
|
|
|
|
|
Member 455770 wrote: Has anyone any clues as to why this is so.
That's the way redirection works. The command interpreter must see those redirection symbols. APIs like ShellExecute() and CreateProcess() are at least one layer removed so the redirection symbols do not get passed on.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
I need to insert an icon for every item in a CListControl , but whatever I do I can'y make the icon (or bitmap )colored , it's just black and white.
here' s my code:
HICON icon;
hList = ImageList_Create( 16, 16, ILC_COLOR32|ILC_MASK , 1, 1);
m_cImageListSmall.Attach(hList);
for( int i=0; i<64; i++ )
{
AND[i] = 0xFF0000;//I'm trying to make it RED colored
XOR[i] = 0x000000;
}
icon = CreateIcon(NULL,16,16,2,8,AND,XOR);
m_cImageListSmall.Add(icon);
m_cListCtrl.SetImageList(&m_cImageListSmall, LVSIL_SMALL);
pDlg->m_listFolders.InsertItem(LVIF_IMAGE|LVIF_TEXT, iIndex, StrPath,0,0,0,NULL );
It's my first post ever , so please forgive my mistakes.
Please help me, I've searched the web for a week, and didn't find the solution.
I tried this example: http://msdn.microsoft.com/en-us/library/ms648051(VS.85).aspx ( and many others ) and it shows me the icon with the drawing ( the yang symbol ) , but it's all black and white, and whatever hex colors I put in those BYTE arrays ( and whatever combination of parameters ( on CreateIcon ) that I don't get how work( like BYTE cPlanes, BYTE cBitsPixel ) ), it's still black and white.
|
|
|
|
|
Your icon creation is all messed up.
Here's a snippet creating a 32bpp 16x16 icon, all bright red:
<code>
m_cImageListSmall.Create(16, 16, ILC_COLOR32|ILC_MASK, 1, 1);
<code>
BYTE AND[32]; <code>
for( int i=0; i<32; i++ )
{
AND[i] = 0xFF;
}
<code>
DWORD XOR[256]; <code>
for( int i=0; i<256; i++ )
{
XOR[i] = 0xFFFF0000; <code>
}
HICON icon = ::CreateIcon(NULL,16,16,<code>1,32</code>,AND,(BYTE*)XOR); <code>
m_cImageListSmall.Add(icon);
Mark Salsbery
Microsoft MVP - Visual C++
modified on Tuesday, November 11, 2008 1:05 PM
|
|
|
|
|
I have tried your way. No success. The icon does not appear , or is of background color( my code creates a black colored icon ). Maybe I'm doing something wrong in the project. If you can send me a working project with your code , it will be easyer for both. I hope it's not to much to ask.
|
|
|
|
|
Maybe you're rendering it incorrectly
Here's how I tested before posting that code:
CImageList m_cImageListSmall;
m_cImageListSmall.Create(16, 16, ILC_COLOR32|ILC_MASK, 1, 1);
BYTE AND[32];
for( int i=0; i<32; i++ )
{
AND[i] = 0xFF;
}
DWORD XOR[256];
for( int i=0; i<256; i++ )
{
XOR[i] = 0xFFFF0000;
}
HICON icon = ::CreateIcon(NULL,16,16,1,32,AND,(BYTE*)XOR);
m_cImageListSmall.Add(icon);
CClientDC dc(this);
m_cImageListSmall.Draw(&dc, 0, CPoint(10,10), ILD_TRANSPARENT);
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
It' worked. But I can't use m_cImageListSmall.Draw , because I take the icon from the imagelist.
{
m_cListCtrl.DeleteAllItems();
// Use the LV_ITEM structure to insert the items
LVITEM lvi;
CString strItem;
for (int i = 0; i < m_nItems; i++)
{
// Insert the first item
lvi.mask = LVIF_IMAGE | LVIF_TEXT;
strItem.Format(_T("Item %i"), i);
lvi.iItem = i;
lvi.iSubItem = 0;
lvi.pszText = (LPTSTR)(LPCTSTR)(strItem);
lvi.iImage = 0; // HERE I SET THE INDEX OF THE IMAGE FROM THE IMAGELIST
m_cListCtrl.InsertItem(&lvi);
}
In this case it doesn't seem to work , I can't figure out why.
|
|
|
|
|
I'm not sure what's wrong.
I extended my test with a listview control.
Here's the code:
m_cImageListSmall.Create(16, 16, ILC_COLOR32|ILC_MASK, 1, 1);
BYTE AND[32];
for( int i=0; i<32; i++ )
{
AND[i] = 0xFF;
}
DWORD XOR[256];
for( int i=0; i<256; i++ )
{
XOR[i] = 0xFFFF0000;
}
HICON icon = ::CreateIcon(NULL,16,16,1,32,AND,(BYTE*)XOR);
m_cImageListSmall.Add(icon);
m_ListCtrl.SetImageList(&m_cImageListSmall, LVSIL_SMALL);
m_ListCtrl.SetExtendedStyle(LVS_EX_FULLROWSELECT);
m_ListCtrl.InsertColumn(0, _T("Column"), LVCFMT_LEFT, 100);
m_ListCtrl.InsertItem(10, _T("aaaaaa"), 0);
m_ListCtrl.InsertItem(10, _T("cccccc"), 0);
m_ListCtrl.InsertItem(10, _T("eeeeee"), 0);
m_ListCtrl.InsertItem(10, _T("bbbbbb"), 0);
m_ListCtrl.InsertItem(10, _T("dddddd"), 0);
All the items have a red icon as expected.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
This time it worked. I'm not sure what was the problem. Thank you .
|
|
|
|
|
Cool!
Thanks for the update!
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi all,
I am facing in the retriving value from record set i dont know what is happeninf here .. can some body help me here ...
i am looping through 10 times for following code with try catch block, but for some values it just going to the catch block giving me the exception,something like DB_errorparams
FieldPtr pField = pSourceRS->Fields->Item[iField];
_variant_t Var;
Var = pField->GetValue();
can anybody help me here
vikas da
|
|
|
|
|
The debugger as first aid. Then us. But you should provide us detailed info coming from the first aid tool.
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]
|
|
|
|
|
Thanks Pallini.....
am building my clint it ll take another 30 min get up... in the mean time can you tell me what are the possible senarios when thye function
Var = pField->GetValue();
can fail ..
Thanks alot....
vikas da
|
|
|
|
|
tasumisra wrote: in the mean time can you tell me what are the possible senarios when thye function
Well, this is your task, read the documentation.
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]
|
|
|
|
|
Hello,
I have a CRichEditCtrl on a CMdiChildWnd which works as an edit box on the window.But I am not able to change the color of the text in the edit box but the background color can be changed with the following.
CRichEditCtrl *T2;
COLORREF C(250);
CDC *c = T2->GetDC();
T2->Create(this,Rect2,false);
T2->SetBackgroundColor(false,C);
Thanks
Prithaa
|
|
|
|
|
Use
m_cfDefault.crTextColor = color;
m_T2->SetSelectionCharFormat(m_cfDefault);
where
CHARFORMAT m_cfDefault;
|
|
|
|
|
Hello,
Thanks,
When I do the above the color doesn't change but I get the strike out effect.
CHARFORMAT m_cfDefault;
m_cfDefault.crTextColor = RGB(0,125,0);
T1->SetSelectionCharFormat(m_cfDefault);
Thanks,
Prithaa
|
|
|
|
|
Hi,
Is there any win32 API available for date calculation?
All i need is, once the system date time is read (for EX: Mon, 10 Nov 2008 11:11:20) from this we need to add 72 hours, and the time after 72 hours should be Thu, 13-Nov-2008 12:11:20.
I am able to get the current time from system. But i like to know how to calculate date and time after 72 hours. Is there any API available for this?
Mon, 10 Nov 2008 11:11:20 - This I am able to get from system.
Thu, 13-Nov-2008 12:11:20 - I need to calculate for this date and time (that I should after 72 hours)
Can anyone help me in this regards.
-Nanadu
|
|
|
|
|
The solution is as follows.
<code>
int main()
{
time_t now = time(0);
int number_minutes=72*60;
tm* localtm = localtime(&now);
cout << "The local date and time is: " << asctime(localtm) << endl;
now += (60 * number_minutes);
struct tm* localtm_edited = localtime(&now);
tm* localtm_edited = localtime(&now);
cout <<"The local date and time i is: " << asctime(localtm_edited);
}
return 0;
}</code>
<div class="ForumSig">Somethings seem HARD to do, until we know how to do them.
;-)_AnShUmAn_
</div>
|
|
|
|
|
the "localtm_edited" redefinition..
|
|
|
|
|
is there some error you get? Please check you have not define localtm_edited variable twice in your code.
Some things seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|