|
ShellExecute(hWnd,"open",
"notepad.exe", filename,NULL, SW_SHOW );
There is no spoon.
mail
|
|
|
|
|
Hi,
If I create an activeX component using the visual c++ that comes with vs.net 2003 - Is it possible for a client to download this component and use it without having to download the whole .net framework??
|
|
|
|
|
The simple Answer is YES.
ActiveX created by Visual C++ present in vs.net 2003 doesnot use CLR by default. So, no need of .NET framework.
<marquee> STUCK STUCK STUCK STUCK
Stuck to Programming through an unbreakable bond
My Articles | My Blog
|
|
|
|
|
I am currently using Directshow and VC++ to create a simple movie player. I use IGraphBuilder and IMediaEvent interface to render the file (using IGraphBuilder::RenderFile followed by IMediaEvent::Run). When the user selects another movie, I first remove all the filters in the graph (using IGraphBuilder::RemoveFilter) and load the new movie as before. The problem is, there seems to be a memory leak somewhere in my app, since everytime the user selects a new movie, my app's memory usage (seen from Windows Task Manager) always rises by around 1MB and stays there.
Could someone tell me what the possible causes for this leak is? Or does someone know a good sample on this topic?
Thanks!
|
|
|
|
|
I want to receive the data from a videoport!
I create a videoport g_pVPE by DirectDraw!
but after I call g_pVPE->startVideo(&ddvpi),
hRet==DDERR_INVALIDPARAMS.
That is I set some parameters wrong!
The setting of parameters are as follows,please help me find the error!
thanks!
int g_CropTop=0x3;
int g_CropLeft=0x1d;
#define CAPWIDTH 800//620
#define CAPHEIGHT 600//440
int g_SurfWidth = CAPWIDTH/2;//310;
// NOTE: g_SurfHeight has to start from CAPHEIGHT/2,
// because of interlace data
int g_SurfHeight = CAPHEIGHT/2;//220;
DDVIDEOPORTINFO ddvpi;
memset(&ddvpi, 0, sizeof(ddvpi));
ddvpi.dwSize = sizeof(ddvpi);
ddvpi.lpddpfInputFormat = &InputFormats[0];
ddvpi.dwVPFlags = DDVP_CROP | g_VPFlags| DDVP_PRESCALE;
ddvpi.rCrop.left = g_CropLeft;
ddvpi.rCrop.right = ddvpi.rCrop.left + CAPWIDTH;
ddvpi.rCrop.top = g_CropTop;
ddvpi.rCrop.bottom = ddvpi.rCrop.top + CAPHEIGHT/2;
ddvpi.dwVBIHeight = ddvpi.rCrop.top;
ddvpi.dwPrescaleWidth = g_SurfWidth;
ddvpi.dwPrescaleHeight = g_SurfHeight;
ddvpi.dwOriginX=0;
ddvpi.dwOriginY=0;
hRet = g_pVPE->StartVideo(&ddvpi);
if(hRet!=DD_OK)
{if(hRet==DDERR_INVALIDOBJECT)
..................
if(hRet==DDERR_INVALIDOBJECT )
........................
if(hRet==DDERR_SURFACELOST)
..............
}
|
|
|
|
|
Must I set the
g_pVPE->SetTargetSurface()
before I called g_pVPE->StartVideo(&ddvpi)
|
|
|
|
|
Hi all,
im currently workin on capturing video function under Directshow.
i saw the example over at the website in msdn but i dun seen to understand and duno how to start also..
http://www.msdn.mircosoft.com/archive/default.asp?url=/archive/en-us/directx9_c/directx/htm/capturingvideotoanavifile.asp
can someone help me in this pls
tks
|
|
|
|
|
Hi, I'm a beginner of Visual C++.
And I have a problem in my project, please help me.
In my project,there is a Static text named IDC_STATICTIME,
I put a timer clock on it.And I want to use OnCtlColor function to change the background of the Static text.
Here is the code :
HBRUSH CCallDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CBitmapDialog::OnCtlColor(pDC, pWnd, nCtlColor);
pDC->SetBkMode(TRANSPARENT);
//pDC->SetBkColor(TRANSPARENT);
if (pWnd->GetDlgCtrlID() == IDC_STATICTIME)
{
pDC->SetTextColor(RGB(0, 0, 255));
pDC->SetBkMode(TRANSPARENT);
}
return hbr;
}
But when I compile, it changed only the Text color.
What will I do to change BkMode of the static?
Thank you very much.
King of Merit
|
|
|
|
|
What have you got underneath the static text?
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hi,
On the dialog hearder add
CBrush m_brush;
On OnInitDialog Add
m_brush.CreateSolidBrush(RGB(255,0,0));
OnCtlColor Add
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
// TODO: Change any attributes of the DC here
if (pWnd->GetDlgCtrlID() == IDC_STATICTIME)
{
// Set the text color to red
pDC->SetTextColor(RGB(255, 255, 255));
// Set the background mode for text to transparent
// so background will show thru.
pDC->SetBkMode(TRANSPARENT);
// Return handle to our CBrush object
hbr = m_brush;
}
// TODO: Return a different brush if the default is not desired
return hbr;
This will work 4 more information have a look @ the msdn
Sujan
|
|
|
|
|
I´m one of those newbies, who would just paste #include-directives until the compiler doesn´t complain anymore. But now I´m pretty stuck up in managing my class-declarations:
I got two classes, each containing a pointer to the other one in order to be able to call the other´s functions.
To be more precise: ClassB is a member of ClassA and should be able to notify ClassA about changes.
There should be nothing special about calling other classes´ functions but how do I get the Compiler to understand, that I´m not trying to do anything illegal?
I tried for hours until I ended up including "#f***u" to all project-files.
For a clean declaration I should #include the headers of embedded classes. But is there any workaround that I can use, if the embedded class itself needs the declaration of the original class?
I hope you can help me out of my misery
Thanx,
Stefan
|
|
|
|
|
A.h :
<font color=#FF0000>class B;</font>
class A {
B*^pB;
};
B.h :
class B {
A* pA;
};
TOXCCT >>> GEII power
|
|
|
|
|
I finally give up. I have here two very simple forms that (for demonstration purposes) consist of a single click button. When you click on the button, the form becomes invisible, and the other becomes visible. you can keep going back and forth till your coffee needs re-heating in the the microwave having developed a really nice thick skin!!
BUT IT DOESN'T WORK!!!!
I obviously wanna do much more than this, but what I'm trying to do is to write successfully from one form to the other and back, then a whole world of possibilities are opened up to me. I have tried many ways (hence the comments) but always get compiler errors such as
error C2512: 'datapassing::Form1' : no appropriate default constructor available
amongst others.
Using Microsoft Visual C++.NET V2003
I could manage forms untill .NET decided to manage them for me!!
Form 1
Code:
#pragma once
#include "Form2.h"
namespace datapassing
{
//public __gc class Form2;
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
public __gc class Form1 : public System::Windows::Forms::Form
{
public:
// TellForm2Something( Form2* pForm2 );
// void TellForm2Something( Form2* pForm2 )
// {
// pForm2->make_visible();
// }
Form2 *pFrm2;
public:
Form1(void)
{
InitializeComponent();
pFrm2 = new Form2;
}
public:
void make_visible(void)
{
this->Visible = true;
}
//STANDARD INITIALISATION AND DISPOSING CODE
private: System::Void button1_Click(System::Object * sender, System::EventArgs * e)
{
// TellForm2Something(Form2);
pFrm2->Visible = true;
this->Visible = false;
}
};
}
Form 2
Code:
#pragma once
#using <mscorlib.dll>
using namespace System;
using namespace System::ComponentModel;
using namespace System::Collections;
using namespace System::Windows::Forms;
using namespace System::Data;
using namespace System::Drawing;
namespace datapassing
{
public __gc class Form1;
public __gc class Form2 : public System::Windows::Forms::Form
{
public:
// TellForm1Something( Form1* pForm1 );
// void TellForm1Something( Form1* pForm1 )
// {
// pForm1->make_visible();
// }
Form1 *pFrm1;
public:
Form2(void)
{
InitializeComponent();
pFrm1 = new Form1;
}
public:
void make_visible(void)
{
this->Visible = true;
}
//STANDARD INITIALISATION AND DISPOSING CODE
private: System::Void button1_Click(System::Object * sender, System::EventArgs * e)
{
pFrm1->Visible = true;
//pFrm1->make_visible();
//TellForm1Something(Form1);
this->Visible = false;
}
};
}
|
|
|
|
|
For some reason, when I call the destructor of an instance, it doesn't actually destroy the instance?
Is there something up with my compiler (Microsoft Visual C++ 6.0) or am I misunderstanding how destructors work and/or what they do?
Here is an example of what I am talking about:
class A <br />
{<br />
public: <br />
A(): itsVariable(3) {cout << "A's constructor was called.\n";}<br />
~A() {cout << "A's destructor was called.\n";}<br />
<br />
int GetVar() {return itsVariable;}<br />
void PrintSomething() {cout << "A's PrintSomething function was called.\n";}<br />
<br />
private:<br />
int itsVariable;<br />
};<br />
<br />
int main()<br />
{<br />
A instance;<br />
instance.~A();<br />
<br />
instance.PrintSomething();<br />
cout << "instance.GetVar() returns: " << instance.GetVar() << ".\n";<br />
<br />
cout << "Main has now ended, therefore instance is out of scope.\n";<br />
return 0;<br />
}
The program produces this output:
A's constructor was called.
A's destructor was called.
A's PrintSomething function was called
instance.GetVar() returns: 3.
Main has now ended, therefore instance is out of scope.
A's destructor was called.
Press any key to continue
Any information anyone can give me would be greatly appreicated.
Thanks.
- Michael
|
|
|
|
|
Well, manually calling a destructor isn't something you do unless you're writing a replacement delete operator.
A destructor - in this case ~A() - doesn't free memory for the A object at all, it just runs some code. The memory for the A object is on the stack, so that memory gets freed when main() returns.
--
I'm Michael Dunn and I approve this post.
Vote Trogdor in oh-four!
|
|
|
|
|
The compiler has no idea that you manually called A's destructor, and still generates a call to the destructor at the end of the block.
The C++ standard (section 12.4, paragraph 14) says:
"Once a destructor is invoked for an object, the object no longer exists; the behavior is undefined if the destructor is invoked for an object whose lifetime has ended (3.8). [Example: if the destructor for an automatic object is explicitly invoked, and the block is subsequently left in a manner that would ordinarily invoke implicit destruction of the object, the behavior is undefined.]"
Undefined in the C++ standard means that the implementation is free to do anything.
There's usually very little reason to explicitly call a destructor. If you want to give an automatic (stack) object a shorter lifetime, you normally introduce a new scope block.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
In addition to what the others have said, what do you expect to happen?
The destructor was called. That doesn't mean that the memory associated with the object is destroyed. In the case of stack variables (which you have), there is no memory to be released. If you new'ed the instance, calling the destructor still doesn't release the memory. The delete operator deletes the memory. Even if you delete the object, the memory pointed to by the object will usually still contain valid values for the object. Thus if you invoke methods on a deleted object, it sometimes looks like it was never deleted.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
The destructor is called as part of the process of deleting the object, using the delete keyword, not the other way around.
Marc
MyXaml
Advanced Unit Testing
|
|
|
|
|
I am drawing text over the desktop like this:
HDC hDC;
hDC = CreateDC("DISPLAY", NULL, NULL, NULL);
if (hDC)
{
SetBkMode(hDC, TRANSPARENT);
TextOut(hDC, GetSystemMetrics(SM_CXSCREEN) / 2, GetSystemMetrics(SM_CYSCREEN) / 2, "Hello world!", 12);
}
DeleteDC(hDC);
This text removes when some window overlap the desktop.
Can somebody tell me how programatically clear my text from the desktop?
|
|
|
|
|
Try sending an InvalidateRect to the desktop window.
|
|
|
|
|
It’s so simple when you know how to do this!
Thanks a bunch, Blake!!!
|
|
|
|
|
hi all
how can i create an email account for a user like hotmail registration page
i want to create a user account and an email account in a certain domain
thanks in advance
|
|
|
|
|
go for mail.com and firstname.com may be that can help you
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|
|
I would like to implement evaluation period for my program. I want a user not be able to use my program after some period of time. I was thinking about keeping information in windows registries but one can always change the registries.
What are your suggestions plese help.
|
|
|
|
|
you could have your software have a timed execution length, only be able to run for 60 minutes at a time, and completly disabled the save/export/render/... or have it generate a watermark on the saved data ).
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|