|
Hello,
I'm trying to query whether the PC has a soundcard or not. I #include <mmsystem.h>, and I try to use waveOutGetNumDevs(), but I get the following linker error.
MainFrm.obj : error LNK2001: unresolved external symbol __imp__waveOutGetNumDevs@0
Debug/Clockster.exe : fatal error LNK1120: 1 unresolved externals
What am I missing? Thanks in advance.
Marcus
Make no little plans; they have no magic to stir your blood to action. Make big plans, aim high in work and hope
-- Daniel Burnham
|
|
|
|
|
do you link to the "Winmm.lib" ?
Project Settings / Linker and add that library to the list..
i have not used this function ever before.. but i think this should work
bernhard
Sometimes I think the surest sign for intelligent life elsewhere in
the universe is that none of them ever tried to contact us.
|
|
|
|
|
Add this to your stdafx.h
#pragma comment(lib, "winmm")
- God bless the World
|
|
|
|
|
Gentlemen,
Thank you for the solutions. I went Ernest's so that I can keep it in the source files. Have a good one...
Marcus
Make no little plans; they have no magic to stir your blood to action. Make big plans, aim high in work and hope
-- Daniel Burnham
|
|
|
|
|
I'm trying to make a model rocket simulation where the user can selection file>options from the menu, enter in the rocket data and I'll display a simulation of the rocket flying in the air.
I have the dialog box get the data, I have the functions to do the actual simulation, now I just need to know how to get that data from the dialog box once the user hits OK and then draw the results (I know about the draw functions using dc, but not how to properly implement them in this case).
Also, I have three functions which I use for the simulation, what class should I make them a part of (one does the math, other draws and the third calls the other two).
ie.
void doSimulation()
{
//get data (gravity, mass, etc) from dialog box
for (i=0;i
|
|
|
|
|
Maybe MFC sample Fire can help you. This is dialog-based application with lot of controls and dynamically created image. User changes fire parameters and program redraws the image according to them. You can use this fire for your rocket...
|
|
|
|
|
Just an inquiry...
How do I implement my program so that if I made it an executable file, it's possible to pass "arguments/parameters" to the executable file when it is called...
i.e.
if I made my BOOk Program as an executable file
and I want my executable file of the Book program to accept video file parameters, how do I do this?
In analogy, if i want to open the realplayer.Exe, i command a SHELLEXECUTE with the *.rm file as paramenter and the realplayer automatically opens it.
Thanks in Advance. Best Wishes to all.
|
|
|
|
|
pass the parameters on the command line:
c:\> MyApp.EXE file.ext
in your app, use one of the many command line parsers available here to grab the parameters and act accordingly.
-c
Smaller Animals Software, Inc.
|
|
|
|
|
Sorry, u might have misunderstood my question 'cuz it seems a little bit confusing...
to clarify: I'll set an example.
I have two programs: "X" and "Y" program.
-I programmed X to process video files. then convert it to executable file
-I have another program Y which calls this executable file of X (X.exe) with a VIDEO FILE parameter possibly using the command
ShellExecute (hwnd, "open", "X.exe", [Video File PathName], [Directory of Executable File], SW_SHOWNORMAL);
so the question is, how do i Program X so that it can accept the VIDEO FILE parameter of Y. and open it afterwards.
Y ---video file ---> X.exe
Thanks in Advance...
|
|
|
|
|
The command line parameters can be used in the InitInstance() of
your application. The command line is stored in m_lpCmdLine which is
a char array. If you pass your parameter with a slash (ie. /MYPARM)
they will be considered flags. If you don't include the slash the first
parameter will be considered to be the file you want to open. You can
turn off that behavior my setting:
cmdIndo.mShellCommand = CCommandLineInfo::FileNew;
but why not just include the slash?
*NOTE you can test your command line parameter in the developer studio!
see the PROJECT - SETTINGS - DEBUG(tab)
I usually deal with the command line in my applications InitInstance() just before:
// Parse command line for standard shell commands, DDE, file open
CCommandLineInfo cmdInfo;
ParseCommandLine(cmdInfo);
|
|
|
|
|
Thanks a lot .. I'll try to implement your suggestion.
|
|
|
|
|
Hi,
Does anyone know how to go about programatically enumerating the network server dns name etc, on a mapped dive under NT?
Say I have a drive H:\ I can see that the server path is 'trtdatasrv\data' in Explorer.
I have a database for cataloging files, but need to know if the user is pointing to the same H drive as well as others, and if not map to it.
Thanks,
Giles
|
|
|
|
|
Hi Giles:
You need to use the Distributed File System (Dfs) Functions....
Start with NetDfsEnum and you will can find other functions that will can help you... ;););););););)
Best Regrards....
Carlos Antollini.
Sonork ID 100.10529 cantollini
|
|
|
|
|
Hi Folks!
I'm trying to print a CDialog to a printer CDC. Without any scale conversion, it's way to small. So I use the CWnd::Print function to draw to a bitmap, and StretchBlt() it onto the printerDC. It works, but the resolution of the text is horrible. How can I get a CDialog to print at a higher resolution?
If it's not too stupid a question, I'd be grateful for some help.
Jonnie
|
|
|
|
|
Printer page has more pixels than dialog, I guess your problem is not resolution but pixelization. Try to make smooth magnification using SetStretchBltMode.
|
|
|
|
|
Thanks. Doesn't seem to be the solution though. Isn't it possible to pass the CDialog a device context with a higher resolution, and get it to draw it (avoiding the rasterization which occurs when stretching)?
Jonnie
|
|
|
|
|
I'm having problems using qsort on a CArray of pointers. I've read the CP article 'Using qsort on arrays of sequential data' but this doesn't sort pointers - it only mentions having to do a second level of casting when sorting pointers.
Here's a simplified version of what I'm doing:
header file
===========
// data to be sorted
class CFundData
{
public:
CFundData() {}
virtual ~CFundData() {}
CString m_sFundId;
CString m_sFundName;
};
// array of CFundData*
typedef CArray<CFundData*, CFundData*> CFundDataPtrArray;
// sorting functions
typedef int (*QSORT_FUNC_T)(const void*, const void*);
void SortFundData(CFundDataPtrArray& arrayFundData);
int __cdecl CompareFundData(const void* elem1, const void* elem2);
implementation file
===================
void Foo()
{
// array of CFundData*
CFundDataPtrArray arrayFundData;
// populate array with data
CFundData* pFD = NULL;
pFD = new CFundData; pFD->m_sFundId = "S100"; pFD->m_sFundName = "GHI";
arrayFundData.Add(pFD);
pFD = new CFundData; pFD->m_sFundId = "S200"; pFD->m_sFundName = "ABC";
arrayFundData.Add(pFD);
pFD = new CFundData; pFD->m_sFundId = "S300"; pFD->m_sFundName = "DEF";
arrayFundData.Add(pFD);
// sort the array
SortFundData(arrayFundData);
}
void SortFundData(CFundDataPtrArray& arrayFundData)
{
// sort array using qsort and the comparison
// function CompareFundData
if (arrayFundData.GetSize() > 0)
{
qsort((void*)arrayFundData[0], (size_t)arrayFundData.GetSize(),
sizeof(CFundData*), (QSORT_FUNC_T)CompareFundData);
}
}
int CompareFundData(const void* elem1, const void* elem2)
{
// comparision function to sort by FundName
CFundData* pFD1 = (CFundData*)elem1; // 'bad' first time called
CFundData* pFD2 = (CFundData*)elem2; // 'good' first time called
return pFD1->m_sFundName.Compare(pFD2->m_sFundName);
}
The first time CompareFundData is called pFD2 is ok (it's the first item in the array) but although pFD1 'looks' like the second item in the array, it is not a valid CFundData object.
I know I should probably be using the STL, but I don't want to bring it into the app for this 'simple' sort. Can anyone help?
Gavin
|
|
|
|
|
I would recommend using STL and a vector template.
May sound a pain, but is much easier than it seems and gets around loads of problems with CArray.
e.g.
#include <vector>
using namespace std;
vector<CFundData> vCFundData;
CFundData a, b, c;
vCFundData.push_back(b);
vCFundData.push_back(a);
vCFundData.push_back(c);
sort(vCFundData);
Also see STL Sort Article
Hope this helps.
Giles
|
|
|
|
|
I know I should probably be using the STL, but I don't want to bring it into the app for this 'simple' sort.
You really should, there's nothing wrong with bringing STL to an app however small that app is. Note also that STL sort algorithm will work with your CFundDataPtrArray s, no need to switch to std::vector s.
Anyway, your problem with how you're using qsort is that you need an extra layer of indirection. Do not pass pointers to qsort , pass it pointers to pointers. Here's how:
void SortFundData(CFundDataPtrArray& arrayFundData)
{
if (arrayFundData.GetSize() > 0)
{
qsort((void*)&arrayFundData[0],
(size_t)arrayFundData.GetSize(), sizeof(CFundData**),
(QSORT_FUNC_T)CompareFundData);
}
}
int CompareFundData(const void* elem1, const void* elem2)
{
CFundData** pFD1 = (CFundData**)elem1;
CFundData** pFD2 = (CFundData**)elem2;
return (*pFD1)->m_sFundName.Compare((*pFD2)->m_sFundName);
} Again, this would be greatly simplified by using STL sort , which is a generic soultion that will pay off in the long term.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks for your reply - the qsort now works a treat!
I've had a go at using the STL sort and vector:
// declare vector
vector<cfunddata*> vFD;
vector<cfunddata*>::iterator it;
// populate vector
...
// sort the vector
sort(vFD.begin(), vFD.end(), compareFundName);
// comparision function
bool compareFundName(const CFundData* lhs, const CFundData* rhs)
{
return lhs->m_sFundName < rhs->m_sFundName;
}
This works, and is definately neater than the qsort approach. Is this the best STL way? You mentioned using STL sort with CFundDataPtrArray, but I'm not sure how to do this.
Gavin
|
|
|
|
|
This works, and is definately neater than the qsort approach. Is this the best STL way? You mentioned using STL sort with CFundDataPtrArray, but I'm not sure how to do this.
This should do:
std::sort(
&arrayFundData[0],
(&arrayFundData[0])+arrayFundData.GetSize(),
compareFundName);
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Wow! That's very nice - I'll take it. Thanks for your help.
Gavin
|
|
|
|
|
Hi,
I cant find classwizard to handle messages as WM_CREATE ...
Where is it ??
|
|
|
|
|
The short answer is: it's gone.
The class wizard in VS .NET is replaced by the property grid. Simply open the cpp file of your class and then click on the property tab. You will see the events and messages in the grid.
// Fazlul
Get RadVC today! Play RAD in VC++
http://www.capitolsoft.com
|
|
|
|
|
Thankx
And handle messages WM_CREATE for control as button, static ??
...in the resource editor is the page "messages" disable for control ((
Wiizi
|
|
|
|