|
I'm not using MFC at all.
I only searched through the documentation on StretchDIBits and other bitmap API functions which reads:
Windows 98/Me, Windows 2000/XP: StretchDIBits has been extended to allow a JPEG or PNG image to be passed as the source image.
So I was wondering how to pass a JPEG pr PNG image to this function, maybe I can read from the disk ????
|
|
|
|
|
If not using MFC then I would suggest using GDI+ as was already suggested.
Image::FromFile("PathToYourImage.jpg");
Art
|
|
|
|
|
Hi guys!!!
In my application,I have to copy a indefined quantity of files in different folders.
Each folder can contain different quantity of data ( ex: folder1:400MB,folder2:1.5GB etc..)and if necessary it'll be created a new folder during the copy.
It shouldn't be a problem to implement it and check the max value for each folder,but the location of each files is collect in a table in a Database and after that it'll be necessary to update the same table with a new position of each files.
I'd like to know if someone have already met a problem like this and in particular if it already exists an algorithm that permit to optimize the copy of files in order to save space.
Thanks in advance for help.
And I'd like to wish at all comunity GOOD EASTER!!!
Andrea
|
|
|
|
|
Hi, everbody.
I made a simple screensaver that displays a piece of text and the name of the current user. I use scrnsave.lib and use getenv() function to take the username. It works fine when I click to myscreensaver.scr file and show the name and the text but when I copied it to WINNT\system32 and select myscreensaver to be the one from display properties it opens an gives an error then close(it dose not give error also at preview mode). When I take out getenv() function it works again. So I think the problem is trying to read enviroment variables from a screen saver application. Is there a method to read enviroment variables that does not cause error and please think that how to read enviroment variables when the screen saver is password protected in NTs.
karanba
|
|
|
|
|
Have you already tried to see what the getenv() returns when your app is used as a "normal" sceensaver ? (messagebox...)
~RaGE();
|
|
|
|
|
Yes. It return the true value. It gives error only when I select it as my screen saver from display properties and wait to appear!?
karanba
|
|
|
|
|
It sounds like Windows doesn't create an environment block for screensavers when it runs them. Instead of retrieving the user's name from an environment variable, just use the API function GetUserName .
Software Zen: delete this;
|
|
|
|
|
When I do a build, it would be very useful to put hte build date/time in so when the application runs this is displayed.
I can't use the file stamps because when its installed or copied these change.
Any suggestions ?
Thanks everyone
Elaine
The tigress is here
|
|
|
|
|
Use the __DATE__ and __TIME__ predefined macros.
|
|
|
|
|
When Internet Explorer create an EditControl (for example...) it doesn't create a window for each control (use Spy++ to verify that ).
I need the same thing (like Flash for its editbox), how can I do that?
Thanks
|
|
|
|
|
Hi,
I've set it's buddy to my edit control :
m_spinPtSpeed.SetBuddy(GetDlgItem(IDC_SPIN_PTSPEED));
m_spinPtSpeed.SetRange(1,14)
and I want to increase or decrease the value in the edit box,and when type a value into edit box,spin control can increase or decrease the current value in the editbox.So I handle the message UDN_DELTAPOS ,but the editbox's value did't change!
void CCam1Set::OnDeltaposSpinPtspeed(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
// TODO: Add your control notification handler code here
//Get value from the edit control
m_nPtSpeed=(int)GetDlgItemInt(IDC_SPIN_PTSPEED);
//adjust value
m_nPtSpeed=m_nPtSpeed-pNMUpDown->iDelta;
//display new value
SetDlgItemInt(IDC_SPIN_PTSPEED,(UINT)m_nPtSpeed,T
RUE);
*pResult = 0;
}
Can you help me solved my another problem
|
|
|
|
|
Is IDC_SPIN_PTSPEED mapped to a CEdit control or a CSpinButtonCtrl control? Its name implies a CSpinButtonCtrl control yet its use implies a CEdit control.
|
|
|
|
|
Hi DavidCrow,
Thanks for your directions,I made a obvious mistake,I had test it ok!thanks!
Can you help me to solve my another problem? If Can ,I will E-mail my demo project for demonstrate problem to you?
|
|
|
|
|
Just post the relevant code here for all to see. The more eyes, the better! Make sure you include what problem you are seeing, any error messages, what you've done so far to isolate the problem, etc.
|
|
|
|
|
I had post my another problem's code in last thread(there is link),I want to make the problem clear,so I made a demo project,but it's bigger than permit post in the forum .Who can offer the FTP position so can I place the demo project to be download? Or I will send to him directly
|
|
|
|
|
Hello, I'm new to VC++ and have problems displaying a DIB in a formview.
To get the device context of my formview and display in it my DIB, I use :
CPaintDC dc(this);
CDC* pDC = &dc;
StretchDIBits(
pDC->GetSafeHdc(), // dc
300, // x dest
300, // y dest
int(proc->IMAGE_WIDTH), // x dest dims
int(proc->IMAGE_HEIGHT), // y dest dims
0, // src x
0, // src y
int(proc->IMAGE_WIDTH), // src dims
int(proc->IMAGE_HEIGHT), // src dims
proc->img->imageData, // array of DIB bits
proc->bmi, // bitmap information
DIB_RGB_COLORS, // RGB or palette indexes
SRCCOPY // raster operation code
);
Everything compiles fine, but when I launch my application, the picture doesn't show.
Could someone tell me if I did something wrong or forgot to add something to make the picture appear (I tried to do the same with a dialog box and used the onPaint() method that was automatically called when I forced to redraw my window, but I don't know how to do that with a formview).
Any help would be much needed.
Thank you
|
|
|
|
|
1. where are you doing the StretchDIBBits? (OnDraw?)
2. what is the return value from Stretch*?
3. try calling GetLastError just after Stretch*
4. is the DIB valid?
-c
|
|
|
|
|
1. Let me first explain more precisely what I'm trying to do : I grab images from a video file and I would like each image to be displayed with StretchDIBBits when I press on a "play" button. So I put my StretchDIBBits function in the function called when I pressed the play button(OnPlay). Tis is probably where I'm wrong because I don't do it on the OnDraw method.
What I tried was to call the OnDraw method in the OnPlay function. Everything compiles but I get an execution error, so I might not be able to do that.
2-3. my Stretch method doesn't give an error, and my DIB is valid.
I think that my only problem is to make my program actually display the picture.
thanks for your help
|
|
|
|
|
sandrineV wrote:
What I tried was to call the OnDraw method in the OnPlay function. Everything compiles but I get an execution error, so I might not be able to do that.
yes, that's true. OnDraw will be called when Windows sends a message to tell your app that it needs to be redrawn. if you want to tell Windows to tell your app to readraw itself, you can use CWnd::Invalidate to invalidate a window. so, at each frame:
1. load the DIB
2. call Invalidate on the CView
in the CView's OnDraw, draw the DIB
-c
|
|
|
|
|
Thanks for your answer,
When I do what you said, I still have an execution problem at the end of my StretchDIBits. Could this be because a formview is not a valid device context ? I ask this because I was able to draw the picture using the same function (StretchDIBits) in a dialog based application without problems...
Thanks
Sandrine
|
|
|
|
|
you should be able to draw on a CFormVIew the same way you would any other view.
when you say 'execution error', do you mean the application asserts, or gives an access violation?
-c
|
|
|
|
|
it gives an access violation...
Sandrine
|
|
|
|
|
make sure the DIB is valid before you draw it. OnDraw will probably be called by the OS long before you get a chance to load the DIB.
-c
|
|
|
|
|
I need to treat NM_RCLICK of a non-empty list control m_list1 placed a form view, using MFC. Here's the code:
void CSimpleView::OnRclickList1(NMHDR* pNMHDR, LRESULT* pResult)
{
int index;
UINT uFlags;
CPoint p;
GetCursorPos(&p);
ScreenToClient(&p);
if ((index = m_list1.HitTest(p, &uFlags)) > -1)
TRACE(_T("OK %d\n"), index);
*pResult = 0;
} It fails every time returning -1 on index
Do you know what's wrong here?
rechi
|
|
|
|
|
m_list1.ScreenToClient(&p); ?
~RaGE();
|
|
|
|