|
CLASS:
#pragma once
template<typename ty="">
class dzeta
{
Ty xval;
public:
dzeta(void);
virtual ~dzeta(void);
friend Ty GetVal( const dzeta<ty>& );
friend Ty GetVal2(const dzeta<ty>& DzA, const dzeta<ty>& DzB);
};
Operations:
#include "StdAfx.h"
#include ".\dzeta.h"
template<typename ty="">
dzeta<ty>::dzeta(void)
{
}
template<typename ty="">
dzeta<ty>::~dzeta(void)
{
}
template<typename ty="">
Ty GetVal( const dzeta<ty>& Dz)
{
return Dz.xval;
}
template<typename ty="">
Ty GetVal2(const dzeta<ty>& DzA, const dzeta<ty>& DzB)
{
return DzA.xval + DzB.xval;
Declarations:
dzeta<int> DzetaA, DzetaB;
int dzVals = GetVal2(DzetaA, DzetaB);
int dzVal1 = GetVal(DzetaB);
}
Compiling resources...
Linking...
GenPermut.obj : error LNK2019: unresolved external symbol "int __cdecl GetVal(class dzeta<int> const &)" (?GetVal@@YAHABV?$dzeta@H@@@Z) referenced in function _main
GenPermut.obj : error LNK2019: unresolved external symbol "int __cdecl GetVal2(class dzeta<int> const &,class dzeta<int> const &)" (?GetVal2@@YAHABV?$dzeta@H@@0@Z) referenced in function _main
Debug/GenPermut.exe : fatal error LNK1120: 2 unresolved externals
======
Default return was int and it works, but LINKAGE ERRORs disappear when:
#pragma once
template<typename ty="">
class dzeta
{
Ty xval;
public:
dzeta(void);
virtual ~dzeta(void);
friend Ty GetVal( const dzeta<ty>& Dz) {return Dz.xval;}
friend Ty GetVal2(const dzeta<ty>& DzA, const dzeta<ty>& DzB){return DzA.xval + DzB.xval;}
};
Generating Code...
Compiling resources...
Linking...
Build log was saved at "file://d:\VSProjects\v71\GenPermut\Debug\BuildLog.htm"
GenPermut - 0 error(s), 0 warning(s)
---------------------- Done ----------------------
Rebuild All: 1 succeeded, 0 failed, 0 skipped
|
|
|
|
|
hello,
i want to write a frontend for an audio encoder.
is there a way to start the encoder exe with the desired cmd line parameters and wait for its completion before starting the next encoding process?
thx!
|
|
|
|
|
Yes, but I can not remember the function name(s) right now. Since the question has been asked by other people in the past, I reccomend you check the FAQs and look for articles or totorials at codeproject. Also search MSDN library, that is where I found the information the one time I needed to do this.
INTP
|
|
|
|
|
:-DJust spoted this FAQ:
http://www.codeproject.com/system/newbiespawn.asp?target=FAQ
Enjoy!
INTP
|
|
|
|
|
thx man! i think my search methods suck...
|
|
|
|
|
Hi! I have a dialog with a Webbrowser activeX control. When I start a file download (Using save as in the context menu) the download dialog starts as expected. If I close my dialog however, the file download is also cancelled. Can someone explain why this is and how I should change my app to get the file dialog to stay alive after my app is closed.
Cheers
Dom
p.s. VC++ 6.0, Modal dialog.
|
|
|
|
|
Your app is the parent and when you close the parent all child processes and associated windows should also close. On solution may be to just hide (or minimize) the app when close is selected and let it wait until the download is complete or an error occurs, then finish closing the app.
INTP
|
|
|
|
|
I kind of thought that was going on. Any ideas how Internet Explorer does it?
Cheers
D
|
|
|
|
|
I do not know it you can shut down internet explorer with out canceling the download. The dialog that is showing the download progress is not a modal dialog and therefore you do not have to close it in order for you to do other tasks in your application. If you wanted to you could create a seperate app to do the download then launch it from your main app, that way it is just anouther program running in its' own thread.
I reccommend you look at the codeproject home page and look for aticles on dialogs under the "MFC controls" section.
INTP
|
|
|
|
|
Hi! I have a dialog in my application that has a beginners version with all the controls spaced out with text explaining what they do. I want the user to be able to check a box and get a different view of the same dialog with the same controls layed out more compactly. I can do this in a longwinded way by doing SetWindowPos() on all the controls, but I was wondering if there is a way to do this by designing the form in the form designer and changing which one is used at runtime.
Cheers
Dom
|
|
|
|
|
It sounds like you could just design 2 different dialogs containing the same controls with a different layout for both. You just needed to design your CDialog derived classes constructor to take an resource ID and maintian a variable some where that holds the curent ID to use.
There is the second option of placing the controls on top of each other and give them IDs like IDC_LISTBOX1, IDC_LISTBOX2. Then show controls with IDs ending with 1 when box is unchecked and show controls with IDs ending with 2 when box is checked. I see problems with this method: (1) you need to create 2 version of each command handler for each ID (1 & 2) [or manualy change the message map to direct commands to the same handle], (2) the more compact layout will probably require a dialog size change.
INTP
|
|
|
|
|
Thanks, I think option 1 sounds best. Any idea how the data would be shared between the controls on the different dialogs?
D
|
|
|
|
|
The same code would work for both dialogs the only difference between them is the dialog ID, every thing else remains the same.
Example:
1) Create dialog 1 and add all the controls you wish to appear on it.
2) Create dialog 2 select and copy all controls from dialog 1 and paste them to dialog 2, the rearange the controls as you see fit.
Now you have 2 dialogs containing controls with the exact same IDs.
When you create the dialog you would do some thing like this:
CMyDialog dlg(m_MyDlgID);
Since the only difference is the dialog ID and not the class used to create the dialog, the data source is the same for both dialogs.
INTP
|
|
|
|
|
Hi,
I have one namespace extension implemented, i want to access the addressbar of the explorer, how do i do that?
In the IShellBrowser interface there is a method GetControlWindow but this returns only toolbar,statusbar,tree and progress,
how do i get the handle to the addressbar.
Thanx regards,
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|
|
it can count sin,cos....
thank you!!
|
|
|
|
|
*sigh*
did u all get visual studio for xmas or something?
try being a little more specific about what ur having trouble with and u might get some help
saying "i cant code" isnt going to cut it here im afraid
"there is no spoon" biz stuff about me
|
|
|
|
|
You need func of sin,cos...
so first
#include "math.h" to yr .cpp file than u direct getting the func abt what u need........
reply me +ve.....
|
|
|
|
|
l a u r e n wrote:
did u all get visual studio for xmas
Mean, but cute! And no, I've had it long enough for Microsoft to declare it obsolete - a couple of weeks, at least.;P
"Another day done - All targets met; all systems fully operational; all customers satisfied; all staff keen and well motivated; all pigs fed and ready to fly" - Jennie A.
|
|
|
|
|
Hi,
Did you mean math functions?
With Regards,
R.Selvam
|
|
|
|
|
#include <math.h>
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I am doing some work so the screen designer works with any type of derived window classes, Dialog, Property Pages, etc.
I am working on storing the actual definition in a database or XML file so that changes that are made to the screens are permanent and returned when the application is next run.
Controls can be configured to retrieve and save data from database field so users can decide at runtime where the data for a newly created control should be loaded and saved from.
i want code in VC++
|
|
|
|
|
i assume u mean ur designing a new windowing system of some sort ... that usually implies that YOU will be writing the code not asking us to do it for you ... unless u are a project manager without any programmers that is
why dont u be a bit more specific in your questions and u might get a bit of help
have a nice day now...
"there is no spoon" biz stuff about me
|
|
|
|
|
I am doing some work so the screen designer works with any type of derived window classes, Dialog, Property Pages, etc.
I am working on storing the actual definition in a database or XML file so that changes that are made to the screens are permanent and returned when the application is next run.
Controls can be configured to retrieve and save data from database field so users can decide at runtime where the data for a newly created control should be loaded and saved from.
i want code in VC++
|
|
|
|
|
i am using third party COM component...
I have put them in try catch block for any com error..
by using _com_error i am able to retrive the error code and error message... But i want to filter out some of the error code say 0x80004005 (unexpected error). When this error occurs i just handle the error gracefully without notifying the user of the actual cause.
My question is.. Is there any #define for 0x80004005 like
#define COM_UNEXPECTED 0x80004005 so that i can use it in my switch case like
switch(ce.Error())
{
case COM_UNEXPECTED:
....
default:
...
}
now my switch looks like this
switch(ce.Error())
{
case 0x80004005:
....
default:
...
}
I know that i can #define it myself but i looking for the one that is already defined.
Thank You.
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|
|
Hi Mr Prakash!
actually yes, u dont need to make one more #define as one already exist there
/****
MessageId: E_FAIL
MessageText: Unspecified error
#define E_FAIL _HRESULT_TYPEDEF_(0x80004005L)
***/
so instead of using that not so gud luking figure 0x80004005
u can smiply use better luking "E_FAIL" for this purpose
I hope ur prob is solved
Abhishek Srivastava
Software Engineer (VC++)
India ,Noida
Mobile no 9891492921
|
|
|
|