|
You can write a Windows NT system service and then have a separate applciation communciate to it using some form of interprocess communication. The secondary applet can appear in the system tray. It is not common, or the preferred method, to have a single application run as a service AND provide a user interface. You run into issues when the user logs off.
|
|
|
|
|
hello
1.
I tried putting some of my code that uses MFC inside a ordinary WIN32 dll and I get an error like this
nafxcw.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in otherdll.obj
Release/otherdll.dll : fatal error LNK1169: one or more multiply defined symbols found
this error I get whenever I try to #include some mfc headers that I need.
is there anyway to make a win32 dll accept MFC or do I have to make a mfc dll?
2.I dwd some sources of mfc dll and it seems like you can only import functions from them from MFC apps
can you not do the same from win32 apps?
and if so how?
3.I may need to send to the function I call from the dll a pointer to a IWebBrowser2 object
Is this possible?
does the dll know about IWebBrowser2? or does this not matter because pointer is pointer?
please reply to these questions
thank you in advance
|
|
|
|
|
Spiritofamerica wrote:
nafxcw.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in otherdll.obj
See here for possibilities.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
to lazy to log on
anyone have anything on the third issue????
|
|
|
|
|
Thanks to "toxcct" and "cedric moonen" Ive learned how to Link my CDialog's together, Thank you both!
<br />
#include Button01Dlg.h<br />
<br />
void CClientDlg::OnButton01() <br />
{<br />
CButton01Dlg dlg;<br />
dlg.DoModal();<br />
}<br />
But Ive come to Notice that only Text can be added to the CButton01Dlg on interface... I was wondering if there was a way to somehow get printf or cout working in Button01Dlg.cpp in order to apply variables?...
Thanks for any Help you guys seem to be the best forum ive found yet!
Just a Human Trying to Live in a Computers World.
|
|
|
|
|
NewbieStats wrote:
to somehow get printf or cout working
You could use sprintf() to write to a character string which could be displayed in a CStatic or CEdit control.
NewbieStats wrote:
Help you guys seem to be the best forum ive found yet!
That's because we are the best programming forum on this planet. (Just my objective humble opinion).
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Would it Go under;
<br />
CButton01Dlg::CButton01Dlg(CWnd* pParent )<br />
: CDialog(CButton01Dlg::IDD, pParent)<br />
{<br />
<br />
}<br />
or
<br />
void CButton01Dlg::DoDataExchange(CDataExchange* pDX)<br />
{<br />
CDialog::DoDataExchange(pDX);<br />
}<br />
or
<br />
BEGIN_MESSAGE_MAP(CButton01Dlg, CDialog)<br />
END_MESSAGE_MAP()<br />
Sorry im kinda new at Interface programs... ive only made databases and so forth jus dos based... But those are the only 3 sections under Button01Dlg.cpp where would i enter it and would it look like;
<br />
sprintf("%s %s you are %s years of age\n", First, Lastname, Age)<br />
<br />
Just a Human Trying to Live in a Computers World.
|
|
|
|
|
What I meant was, you could use sprintf() (which works exactly like printf() but writes to a string vs. standard output) to display values of variables which could be shown by a static text control (i.e. CStatic ) or an edit control (CEdit ). The latter is preferred, since it supports scrolling, which can come in handy when displaying large amounts of text.
The actual display would typically occur within a button handler. For example:
CMyDialog::OnBtnFooClicked()
{
char szResult [256];
int nFoo = someFunction(...);
sprintf (szResult, "nFoo = %d", nFoo);
m_myEditCtrl.SetWindowText (szResult);
CString strResult;
strResult.Format ("nFoo = %d", nFoo);
m_myEditCtrl.SetWindowText (strResult);
Hope this helps.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
I understand now...
Everything works out perfect besides for: "m_myEditCtrl"
I appoligize for my illiterate-ness in MFC...
C:\*\ClientDlg.cpp(190) : error C2065: 'm_myEditCtrl' : undeclared identifier
C:\*\ClientDlg.cpp(190) : error C2228: left of '.SetWindowTextA' must have class/struct/union type
Other then that i understand what you mean and how it will work, but what am i doing wrong when it comes to "m_myEditCtrl"? What do i replace it with?
Just a Human Trying to Live in a Computers World.
|
|
|
|
|
NewbieStats wrote:
C:\*\ClientDlg.cpp(190) : error C2065: 'm_myEditCtrl' : undeclared identifier
The m_ implies that it is a (CEdit ) member variable of the CClientDlg class.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
m_myEditCtrl is a CEdit member of your dialog class, declared in the dialog's .h file. You will also need to associate the member with an edit control in your dialog template.
You can do this dragging an edit control into your dialog template (using the resource editor) and using the ClassWizard to associate the CEdit member variable with the control.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Im still alittle Queued... In class wizard when i go to Member Variables the only Class ID's listed are "IDCANCEL" and "IDOK" the only choices i have are "Add Class" and "Add Variable"
When i click on Add Variable it says "Member Variable Name: m_" where im guessing i put m_myEditCtrl... the only Catagory is "Control" and the only variable type is "CButton" but i dont want it to be a button?
"m_myEditCtrl is a CEdit member of your dialog class, declared in the dialog's .h file." Where and what would i put in CButton01Dlg.h? (would this change my Class ID list to allow me to add it?
"You can do this dragging an edit control into your dialog template (using the resource editor)" Resource Editor?... Dragging an edit control into your dialog template?... Im so Lost =/
Sorry again...
Just a Human Trying to Live in a Computers World.
|
|
|
|
|
NewbieStats wrote:
Im still alittle Queued...
You need to first add an edit control (eg: IDC_MY_EDIT ) to your dialog template using the resource editor. Next, use the ClassWizard to add the m_myEditCtrl variable (category = Control).
Since you're new to VC++, you may want to refer to an introductory text to help you get going. Meanwhile, see this[^] link to see how to add controls to a dialog template.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
It looks like the forum ate one of my replies. In answer to your question about the Control toolbar, here's how to display it:
In VS2003, do View|Toolbox. In VC6, double-click the dialog in Resources tab, then right-click the workspace and select "Controls" from the popup menu.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Thanks! I still say this is the best forum ive seen =)
Im going to try and work with ur tutorials your site provides so i can minimize on these post on the forum for newbie questions hehe... Thanks for puttin up wit my illiterate beginnings of MFC... Ill come back here if any questions or if i finish what im working on for feedback! thanks!
Just a Human Trying to Live in a Computers World.
|
|
|
|
|
NewbieStats wrote:
Thanks for puttin up wit my illiterate beginnings of MFC...
No thanks needed. We're here to help. Good luck!
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Why recommend sprintf ? What's wrong with stringstream or even CString.Format ?
Christian
I have several lifelong friends that are New Yorkers but I have always gravitated toward the weirdo's. - Richard Stringer
|
|
|
|
|
It was the closest thing to printf() which he's familiar with. In my later post I recommended that he use CString::Format() .
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
NewbieStats wrote:
I was wondering if there was a way to somehow get printf or cout working in Button01Dlg.cpp in order to apply variables?
No, those are for console-based applications.
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi everyone,
I'm currently working on an FFT App which gets the Input about the Mic. Once the Mic Buffer is full the Function void void CWaveCtrl::Update(const Fft &FftTransformer) in my Static control is called. Now lets come to the problem. In the Function I can't call GetClientRect() or Invalidate(). I don't know if the problem only exists with those two Functions. This are the Functions i would need The Program always crashes with:
Debug Assertion Failed!
Program: ...\Visual Studio Projects\FFT\Debug\FFT.exe
File: f:\vs70builds\9466\vc\MFCATL\ship\atlmfc\include\afxwin2.inl
Line: 135
Please Help. I have no clue.
MFG
RedDragon2k
|
|
|
|
|
Trace it with single-stepping.
Don't try it, just do it!
|
|
|
|
|
I did and it just seems like the Functiun is unable to get the correct HWND.
I can't be more precioses because when i click retry to debug my system is vveeerrrryyyyy slow 'cause of the bug. But in the Locals Watcher i can see that GetClientRect(rect) return the right Rect Values. Here is the Complete Function:
void CWaveCtrl::Update(const Fft &FftTransformer)
{
CRect rect;
GetClientRect(rect);
int iMaxPoints = min(FftTransformer.Points(),FFT_POINTS * 8);
for(int i=0; i < iMaxPoints; i++)
{
int s = FftTransformer.Tape(i) / 512 + (rect.bottom - 1) / 2;
if (i >= rect.right)
{
Add( i, rect.right - 1, (rect.bottom - 1) / 2);
}
else
{
if ( s < 0 )
Add (i, i, 0);
else if (s >= rect.bottom)
Add (i, i, rect.bottom - 1);
else
Add (i, i, s);
}
}
}
|
|
|
|
|
I'm using this class in my UI thread (which has no dialog, so I needed to make a timer) so that I could fire off 3 different timers. I was wondering is I should wrap the postmessage as well as SetTimer and KillTimer as a critcal sections. My main app will be creating 3 threads that will be creating three timers. Would this help in making sure I did not step on another thread accessing TimerProc at the same time.
Here is the link to the class I'm using.
CWinTimerThread
Thanks
Tom Wright
tawright915@yahoo.com
|
|
|
|
|
Would it hurt anything to give each thread its own timer function?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Well basically each thread is dirived from the CWinThreadTimer class. So it does have it's own timer function. I was under the understanding that the TimerProc used the same memory space regardless of what thread created it. is this not the case.
Tom Wright
tawright915@yahoo.com
|
|
|
|