|
int01h wrote:
Is there any version of jpeglib that is tiny
No. JPEG compression is inherently complex.
without need of using a mfc programming style
Yes. Try googling for libjpeg.
|
|
|
|
|
Hey,
I'm trying to figure out how to remove something my little app has drawn after the user pressed a button.
Drawing code:
CClientDC dc(this);
CPen pen( PS_SOLID, 1, RGB( 0, 0, 0 ));
CPen* pPenOld = dc.SelectObject( &pen );
dc.MoveTo(50, 50);
dc.LineTo(540, 50);
So basically I just want to reset the window back to it's original state before the user pressed the button...
Cheers
|
|
|
|
|
You should be drawing in OnPaint, then you can just stop drawing the line and call Invalidate(FALSE);
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
ok, thanks for the reply! Got it working.. I have however another question: I have a CStatic control that I wish to draw within. I want to do this because I just want to update the drawing area and not the whole window. So if I have a standard window with a CStatic control in it, how would I draw within that CStatic control?
Cheers
|
|
|
|
|
Crap! I solved it... thnx anyhow!
Cheers
|
|
|
|
|
No worries - I only just got out of bed ( time difference )
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
I'm writing a program in c whose output is directed to a file (i.e. myprog > myfile).
My problem is that whenever I print a newline character, printf("\n"), the program outputs both a carriage return and a newline. So while the output should have just one character whose value is 10, the program outputs a 13 followed by a 10.
I this this might have something to do with Windows XP. Has anyone else heard of this?
I would greatly appreciate ANY help that can be offered.
Thanks,
Steve
|
|
|
|
|
SHaroz wrote:
My problem is that whenever I print a newline character, printf("\n"), the program outputs both a carriage return and a newline.
This is the character secuence used to denote "new line" in MS-DOS and derived products (like Windows XP). It's handled by the CRT (C RunTime library) - whenever it sees a LF, it emits CRLF.
To get "correct" line endings, open the file in binary mode. If, like in your example, it's supposed to work even with stdout, I believe you have to freopen "CONOUT$" (or whatever it's called - look up the docs for CreateFile).
++luck;
|
|
|
|
|
I tried mystream = freopen("myfile.out", wb, stdout) and it worked. The newline prints as one character. My problem is that I don't know how to find the file that stdout points to. I could avoid that if I knew a way to simply change the mode of stdout. I also thought that if the program is run like this "myprog > output.txt", argv[2] would be "output.txt". But that didn't work.
Keep in mind that this needs to be ANSI compatable, so I can't use any function that starts with an underscore (i.e. _setmode).
I tried looking up "CONOUT", but found nothing.
Do you think you could offer any more advice?
Thanks,
Steve
|
|
|
|
|
SHaroz wrote:
Keep in mind that this needs to be ANSI compatable
You didn't say that in your original post.
If you need to stay within the bounds of ANSI C, and you still need to emit only LF when running on Win32 (which is an "illegal" Win32 EOL sequence), then you might try linking with binmode.obj.
If that doesn't work, the only thing I can come to think of is to do your output to an internal string buffer, and then resort to fwrite.
++luck;
|
|
|
|
|
I have a program that plays multiple WAVS at the same time. What I cant figure out how to do is adjust the volume levels and panning for each individual WAV during playback. The only info Ive found is about changing the master WAV device volume. Can someone shed some light on how I can change the volumes and pans of individual WAV files (all of which are playing through the main WAV device output)?
Thanks!
Emil
|
|
|
|
|
I think you should look into using the directxsound stuff.. sounds like your limited without it. No pun intended!
Lata
|
|
|
|
|
I have a dialog that maintains a color swatch that is set/modified through MFC's CColorDialog.
It works ok, but when I want to initialize the color swatch in the OnInitDialog(), my color swatch is just the default (black) color I assigned during creation.
Also, when I pop-up the CColorDialog or move anything over my parent dialog, the color-swatch color is lost (resorts back to default black color).
How do I repaint the color swatch in OnInitDialog() and how do I keep my color swatch from loosing its color when other windows move over (repaint) the are it occupies?
Thank you much!
Johnny
Here are some details:
The color swatch is a picture control, Rect property, with IDC_MODEL_COLOR as its name.
I use this fn to update the swatch when CColorDialog returns (IDOK)
// update the color swatch with the RGB color value
void CGraphicsParameters::SetModelColorSwatch(COLORREF rgbColor)
{
CBrush swatch;
swatch.CreateSolidBrush(rgbColor);
CClientDC dc(this);
dc.FillRect(&m_ModelColorSwatch, &swatch);
}
I also call this fn from within OnInitDialog() -- that's when I noticed the problem.
Please help.
Thank you
|
|
|
|
|
You should be painting the colour swatch in OnPaint.
"Pretending to guide me, you led me astray,
And I don't want to fall into your kind of ways." "Melt", Front 242
|
|
|
|
|
Hi Daniel,
I modified my dialog's code to trap the WM_PAINT messages in OnPaint(), but I am still having problems initializing my dialog and the strange case when I do this to my MODELESS dialog:
1) place another window (dialog) object over my Color Swatch client area
keeping it over my Color Swatch
2) Set focus to my dialog with the Color Swatch -- don't move
3) Without moving either dialogs, toggle focus between the two
** the color swatch resorts back to the default (black) color.
Would you know what is going on and what I need to do?
Thanks.
Johnny
Here is what I have now:
//////////////////////////////////////////////////////
// CGraphicsParameters dialog -- .H
class CGraphicsParameters : public CDialog
{
// Other stuff left out for brevety
private:
// use to display colors as a sample swatch on the dialog
COLORREF m_ModelColor;
CRect m_ModelColorSwatch;
// Construction
public:
// use to display colors as a sample swatch on the dialog
void SetModelColorSwatch(COLORREF rgbColor);
}
//////////////////////////////////////////////////////
// CGraphicsParameters dialog -- .CPP
BOOL CGraphicsParameters::OnInitDialog()
{
CDialog::OnInitDialog();
// other dialog initialization goes here
// Initialize the color swatch rectangles - for later painting
// Calculate true location of the color swatch
// Get a pointer to CWnd
CWnd* pModelColor = GetDlgItem(IDC_MODEL_COLOR);
// Find its location on screen
pModelColor->GetWindowRect(&m_ModelColorSwatch);
// Store client coordinates
ScreenToClient(&m_ModelColorSwatch);
m_ModelColorSwatch.DeflateRect(2, 2, 1, 1); // for the sunken control setting
SetModelColorSwatch(m_ModelColor);
return TRUE;
}
void CGraphicsParameters::OnPaint()
{
SetModelColorSwatch(m_ModelColor);
CDialog::OnPaint();
}
// update the color swatch with the RGB color value
void CGraphicsParameters::SetModelColorSwatch(COLORREF rgbColor)
{
CBrush swatch;
swatch.CreateSolidBrush(rgbColor);
CClientDC dc(this);
dc.FillRect(&m_ModelColorSwatch, &swatch);
}
|
|
|
|
|
I did a quick test using the same code as you have here and it worked, so I suggest looking to see if m_ModelColor is set to black somewhere.
"Pretending to guide me, you led me astray,
And I don't want to fall into your kind of ways." "Melt", Front 242
|
|
|
|
|
Hi!
I have a VC++ application which works by itself. I need to convert it into a DLL so that i can call it from VB. I created a new win32 dll and added the source files and the header files to the project. THe application consists of many classes and has a main funciton as starting point. I used the _stdcall calling convention before the main function and declared the function prototype in a header file. The dll compiled without any errors.But when i try to call the dll form VB the runtime error 453 The function not found in the specified dll file pops up
I am a beginner in the VC++ and have very little knowledge of the language.
can u please suggest any solution to the above problem
Thanx
|
|
|
|
|
What you really wan't to do is to convert it into a Active-X control, trust me.
"You can stand all night at a redlight anywhere in town, hailing Marys left and right but none of them slow down. I've seen the best of men go past. I don't wanna be the last..."
|
|
|
|
|
Did you export your function by typing
extern "C" __declspec(dllexport) MyExportedFunction( );
?
|
|
|
|
|
I have used the _stdcall convention since from the help file i reckoned that _stdcall convention is compatible with VB 6
|
|
|
|
|
I had used the _stdcall convention since it is compatible with vb so i need to use the 'c' extern too?
|
|
|
|
|
Hmmm, seems like I read over the VB stuff. So I try it again
You do right in using the _stdcall convention. But the fact is that _stdcall leads to an exported function name that differs from your declared one.
So if your function is declared as
int __stdcall func (int a, double b),
the decorated name is _func@12 (12 is the number of bytes in the argument list).
Thus you either call it that way or you declare an alias in the EXPORT section of your .def file:
...
EXPORT
Func = _func@12
...
Then you can use the name Func in your VB app.
|
|
|
|
|
Hy there,
i'me looking for infos like tutorials and workshop on programming plug-ins for the internet explorer. How can I access to the favorites and how can i make a button with my functionality? These questions should be answered through the tutorial.
Thanks and regards
boa
|
|
|
|
|
|
boaconstrictor wrote:
i'me looking for infos like tutorials and workshop on programming plug-ins for the internet explorer.
<windir>\Program Files\Microsoft SDK\Samples\web\bits
This is a pretty cool example using BITS (background downloading). You need XP to run BITS, however, this code is a IE Plugin, so it could help you.
Good luck.
R.Bischoff | C++
.NET, Kommst du mit?
|
|
|
|