|
Hi there. Can anyone advise me on how to open a image file like JPEG in a MFC application? I have written a MFC application and need to add in the open image file option. Can anyone tell me how to do it? Thank you for any advise.
|
|
|
|
|
|
|
You can also go for GDI+ apis to do the same.
I Touched Osama Bin Ladens Bushy Beard
|
|
|
|
|
It is well-known that the PostThreadMessage function ,only for thread,places (posts) a message in the message queue of the specified thread and then returns without waiting for the thread to process the message.
Q: Whether there is a function which ,similar to SendMessage in function,but for thread not window,sends the specified message to a thread and does not return until the thread has processed the message.
Rap off for you,for me,for our human.
|
|
|
|
|
Hello, guys.
Check this out:
<br />
void CCtrlsDlg::OnDblclkList(NMHDR* pNMHDR, LRESULT* pResult) <br />
{<br />
LPNMITEMACTIVATE pIA = (LPNMITEMACTIVATE)pNMHDR;<br />
*pResult = 0;<br />
<br />
if((-1 == (m_nItem = pIA->iItem)) || (0 == (m_nSubitem = pIA->iSubItem))) <br />
return;<br />
<br />
CRect rc;<br />
m_ctrlList.GetSubItemRect(pIA->iItem, pIA->iSubItem, LVIR_BOUNDS, rc);<br />
<br />
if(!m_pEdit)<br />
m_pEdit = new CEdit;<br />
<br />
CString strText = m_ctrlList.GetItemText(m_nItem, m_nSubitem);<br />
<br />
m_pEdit->Create(WS_CHILD | WS_VISIBLE | WS_BORDER, rc, &m_ctrlList, 12);<br />
m_pEdit->ModifyStyleEx(0, WS_EX_CLIENTEDGE, 0);<br />
m_pEdit->SetWindowText(strText);<br />
m_pEdit->SetSel(0, -1);<br />
m_pEdit->SetFocus();<br />
}<br />
This whole thing displays an edit box for CListCtrl's subitems, but as CEdit control is created it has some odd look - it looks like edit control from Windows 3.1 rather anything else. Where's the problem?
|
|
|
|
|
I'm guessing that you are seeing the System font which looks very old.
Try
m_pEdit->ModifyStyleEx(0, WS_EX_CLIENTEDGE, 0);<br />
m_pEdit->SetFont(&newfont);<br />
m_pEdit->SetWindowText(strText);
where newfont is a CFont that you find acceptable.
Paul Hooper
If you spend your whole life looking over your shoulder, they will get you from the front instead.
|
|
|
|
|
I want to change the data field of Default key. So that my application can be listed and launched from right mouse click
|
|
|
|
|
Hi,
in C# there is an option to set refer url property to HttpWebRequest Class. how can set this vc++. i using CInternetSession,CHttpConnection,CHttpFile. Any one help to me.
Thanks in Advance
Murali.M
|
|
|
|
|
Hi,
in CHttpConnection::OpenRequest() third parameter is the referurl.
|
|
|
|
|
I have done Wh_getmessage hook.
In my filter function i have typecast the Wm_char message
like Say if Char 'A' is pressed i send the char 'A' as it is to the application.
NOw if user press 'B' then what i am doing is changing the Char 'B' to BackSpace character.
TO this point the application is working properly in all application for it is a system wide hook , where pressing of B removes 'A' for B is a backspace character
A , B->backspace
out put = NUll
Now what i am doing is using PostMessage api i am sendging 2 characters to that application which is active
Say POSTMESSAGE(C ,D)
I got these problems:
1. The character C when posted to the application , my filter function is called again and( i have defined a rule for C where if the user type
C then change to E) and i expected C to be printed in the application , but instead E is coming.
I have to find a way how to prevent this ie the postmessage which i have send to the application looping through my filter funcion again and again.
___________________________________________________________________________
2. If i declare like this
A , B->backspace character , Postmessage(C,D)
Expected output
CD
Output obtained in notepad and photoshop
AC and D is removed(Wrong)
Output obtaied in all other application
CD(correct)
_________________________________________________________________________
3. So i tried this method
A , B->NULL , Postmessage(backSpace,C,D)
Expected output
CD
Output obtained in notepad and photoshop
CD(correct)
Output obtaied in all other application
AC and D is removed(Wrong)
Could anyone tell me how i can overcome these problems
Thanks in advance
with regards
vimal
|
|
|
|
|
Anyone knows any face facial detection software that is available free on the website?
Becos I am doing a project on analysis of facial expression and I need to place trackers on the face and output coordinate values
Anyone who can help me pls reply me
I am most grateful
|
|
|
|
|
|
Hi all,
I'm writing an application need to run on pretty much every version of Windows out there. The only major problem I've struck is with scrollbars. I've laid out the child windows within the parent window, calculated the range required, populated a SCROLLINFO struct and used SetScrollInfo() to pass it in. On Win98SE onwards, it all works perfectly - but on 95 and 98, no scrollbars. However, if you open a couple of files, forcing it through the process it will start working - and from then on, perfect. In case it helps, the relevant piece of code (for the vertical scrollbar. HOrziontal shows the same symptoms):
(m_ScrollableArea.Height() is a CRect, and yes, it does have valid values)
<br />
SCROLLINFO SI ;<br />
SI.cbSize = sizeof( SCROLLINFO ) ;<br />
SI.fMask = SIF_RANGE ;<br />
<br />
SI.nMin = 0 ;<br />
int M = m_ScrollableArea.Height()/m_YIncrement ;<br />
m_YRange = ( M*m_YIncrement ) + m_YIncrement ;<br />
SI.nMax = m_YRange ; <br />
M = 0 ;<br />
<br />
SetScrollInfo( SB_VERT, &SI, TRUE ) ;<br />
Any ideas? It's like the API on 95/98 is acting unreliably, but I've got to be doing something to make it happen. Any help would be greatly appreciated - this one is driving me nuts...
--Shane
You can sometimes count every orange on a tree, but never all the treees in a single orange.
|
|
|
|
|
This is a far shot, but perhaps your window needs to get it's Non-Client-Area re-calculated to make space for the Scroll-Bars (maybe it's messed up in 95/8...)
Anyhows, I need to do for my own Scroll-Bars so perhaps Microsoft went the same way
SetWindowPos(0,0,0,0,0,SWP_FRAMECHANGED|SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_NOACTIVATE);
This will force your window into recalculating it's non-client area and perhaps add/remove scroll-bars as necessary.
|
|
|
|
|
Gave it a go, but no cigar. Did find out one thing, though; Windows 98SE/NT/2K onwards, scrollbars handled by the window itself are part of the client area, updated by the system, but still within the client area (do a GetClientRect() with and without scrollbars, and they'll be the same). 95/98, they're part of the non-client area (I tried forcing a repaint of the non-client area but that didn't help either). GetClientRect() changes with/without scrollbars...
Anyway, I'll keep hammering at it - unfortunately it's a must-fix problem for this project. Thanks for the help
--Shane
You can sometimes count every orange on a tree, but never all the treees in a single orange.
|
|
|
|
|
Are you sure about this ?
I'm pretty sure that at-least from Windows-2000 and up, Scroll-Bars are in the Non-Client-Area, as in they are returned by GetWindowRect but not by GetClientRect.
If you want to disable Scroll-Bars, there are many ways that range from Handling OnNcCalcSize and not allowing windows to make space for it's scroll-bar, and up to using the Flat-Scroll Bar API FS_EnableScroll I believe dose the work...
|
|
|
|
|
Oops, my bad. You are correct; I had it around the wrong way in my message (I knew what I wrote... ). 2K is definitely non-client area, and on further investigation I'm unsure about 95/98. But I have tracked down the problem point - SetScrollInfo() Added a GetScrollInfo() to the end of original code fragment, dumped both out to a file like so:
<br />
SetScrollInfo( SB_VERT, &SI, TRUE ) ;<br />
<br />
FILE *f;<br />
f = fopen( "scrollinfo.txt", "a" );<br />
fprintf( f, "m_ScrollableArea.Height() :\t%d\n", m_ScrollableArea.Height() );<br />
fprintf( f, "m_ScrollableArea.Width() :\t%d\n", m_ScrollableArea.Width() );<br />
fprintf( f, "SCROLLINFO for SetScrollInfo()\n");<br />
fprintf( f, "nMin:\t\t%d\n", SI.nMin );<br />
fprintf( f, "nMax:\t\t%d\n", SI.nMax );<br />
fprintf( f, "nPage:\t\t%d\n", SI.nPage );<br />
fprintf( f, "nPos:\t\t%d\n", SI.nPos );<br />
fprintf( f, "nTrackPos:\t%d\n", SI.nTrackPos );<br />
<br />
memset( &SI, 0, sizeof( SCROLLINFO ) );<br />
SI.cbSize = sizeof( SCROLLINFO );<br />
SI.fMask = SIF_ALL;<br />
GetScrollInfo( SB_VERT, &SI );<br />
<br />
fprintf( f, "SCROLLINFO for GetScrollInfo()\n");<br />
fprintf( f, "nMin:\t\t%d\n", SI.nMin );<br />
fprintf( f, "nMax:\t\t%d\n", SI.nMax );<br />
fprintf( f, "nPage:\t\t%d\n", SI.nPage );<br />
fprintf( f, "nPos:\t\t%d\n", SI.nPos );<br />
fprintf( f, "nTrackPos:\t%d\n\n\n", SI.nTrackPos );<br />
fclose( f );<br />
...and we run the application, load one file then load it a second time, and we get this:
m_ScrollableArea.Height() : 944
m_ScrollableArea.Width() : 560
SCROLLINFO for SetScrollInfo() Data for the call into the API
nMin: 0
nMax: 952
nPage: 0
nPos: 0
nTrackPos: 0
SCROLLINFO for GetScrollInfo() Returned SCROLLINFO struct - 0??!
nMin: 0
nMax: 0
nPage: 0
nPos: 0
nTrackPos: 0
m_ScrollableArea.Height() : 944 Open the file a second time
m_ScrollableArea.Width() : 560
SCROLLINFO for SetScrollInfo() Calc the same SCROLLINFO struct...
nMin: 0
nMax: 952
nPage: 0
nPos: 0
nTrackPos: 0
SCROLLINFO for GetScrollInfo() ... but this time it "takes"
nMin: 0
nMax: 952
nPage: 537
nPos: 0
nTrackPos: 0
Basically, when the struct "takes" it works perfectly; when it doesn't, you get no scrollbars. But experimenting, I can't find what makes it work and what doesn't... I've traced the creation/destruction for the window and all it's children and everything is destroyed on close of the first and recreated on opening the second, contents of the SCROLLINFO is the same each time, but sometimes it works and sometimes it doesn't
Sorry for the length of this post, but I wanted to give you all that I know. To be honest, right now I'm completely lost, stumbling around in the dark with my hands in front of me, hoping to blunder into the solution If you have any further suggestions, they're more than welcome.
--Shane
You can sometimes count every orange on a tree, but never all the treees in a single orange.
|
|
|
|
|
I want to make a textcontrol object as in MSPaint..It should act as an object and must be movable and resizable...Please help me out..
|
|
|
|
|
I am trying to compile the RemoteAdmin Example Code. I am getting an error that the file "psapi.h" can't be found.
I am using MSVC6.0 on XP.
Where do you find this file??
|
|
|
|
|
Hello,
http://www.codeguru.com/mfc/comments/50362.shtml
With Regards,
R.Selvam
|
|
|
|
|
<psapi.h> is a header file for the process status API (PSAPI) and is part of the Platform SDK which can be downloaded from Microsoft
Regards,
|
|
|
|
|
Hello, I am just using Visual c++ 6.0 for the first time. I am trying to use a string variable, I set up #include<string.h> and my variable is
string player1;
I am getting 3 errors, all of which around this error, 'string' : undeclared identifier. I have been searching microsoft.com, I can't find a solution, I hope someone will help me. Thank you.
|
|
|
|
|
PS I meant to put #include<string.h>
|
|
|
|
|
|