|
Hi
I have a dll that will be used simultaneously be different processes. The dll opens a database connection that is to shared among all the processes that used this dll. This is to avoid opening the database each time by each processes whenever they need something from the database.
I believe this can be done by sharing the virtual memory using VirtualAllocEx, WriteProcessMemory, ReadProcessMemory apis, is that correct ?
If so is this the correct approach ?
If not what is the best approach ?
Thanks in advance
Regards
The Best Relligion is Science.
Once you understand it, you will know God.
|
|
|
|
|
Hi there,
I have tried to get a dialog to transfer data from a combobox into the view class member but I havent been able to get it to work get crashes.
All I want is a tutorial on how to change som variables in a dialog that effects the members of the view class. This must be a ordinary thing that must want to achive. Every windows program has dialogs to set alot of options etc.
Hope you got something for me!.)
regards
Peter
|
|
|
|
|
Hi
I understand your problem is to accept user input through a dialog and get those data in the View class of a SDI/MDI, is that so ?
Then you could try doing this,
Insert a Dialog into the project.
Add the control you want on the dialog.
Now add a class CUserDlg for the dialog, deriving it from CDailog.
Add member functions like GetName, GetAge, GetGender etc to the CUserDlg, these should return the data that you want to pass to the view class.
Now create a memberf m_dlgUserData of type CUserDlg in the View Class.
Call DoModal to display the Dialog and when finished (ie pressed ok)
Call m_dlgUserData.GetAge(), to get the age of the user. This way you get the age of the user entered in the dialog into the View Class.
Hope I answered your question...
Regards
The Best Relligion is Science.
Once you understand it, you will know God.
|
|
|
|
|
The simplest way of transfering data between dialogs and views. Is to pass a pointer to the view class into the dialog class either via the constructor or via a method that is called before DoModal.
In the constructor, assign the view pointer to a class member variable and then you can call view methods in any of your dialog methods.
Michael
CP Blog [^]
|
|
|
|
|
Hi~
struct Score<br />
{<br />
LPWSTR studentName;<br />
int mark;<br />
Score(LPWSTR sn, int m){ studentName = sn; mark = m; }<br />
}<br />
<br />
Score s1("a",10);<br />
Score s2("b",20); <br />
<br />
Score *ptr = new Score[3];
<br />
ptr[0] = s1;<br />
ptr[1] = s2;
I would like to know what is the value of ptr[2]?
Thanks
|
|
|
|
|
ptr[2] is undefined. However under VC.NET in debug mode it is likely to be set to a junk value (0xCCCCCCCC), whilst in debug mode it could be anything.
It's best not to rely upon these values. If you need arrays that are correctly initialised to a default use a std::vector
std::vector<Score> scores;
scores.resize(3);
scores.at( 1 ) = Score("a",10);
scores.at( 2 ) = Score("b",20);
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts your aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
Hi
I feel you will get garbage. You must provide a default constructor for you sturture if you want to intialize the structure in this case.
Regards
The Best Relligion is Science.
Once you understand it, you will know God.
|
|
|
|
|
Would the new Score[3] create an array of 3 Score objects and use the default constructor? So the statements such as ptr[0] = s1; will use the default assignment operator to copy the objects?
ptr[2] will have garbage values because the default constructor is not provided.
|
|
|
|
|
Hello
I've wrote a program that printed Word documents using Word Automation and used GetPrinter, SetPrinter and DocumentProperties functions to change duplex and default bin settings of the printer.
Everything worked with HP Laserjet printers (HP Laserje 5M, for example), but it doesn't work with a new color CLJ3700 PS.
When I try to change printer settings all functions show that everything is OK, but when I print something it uses the preset settings
Can anyone tell me why is that happening?
Thank you in advance
|
|
|
|
|
I need urgent help!
I have no idea whats wrong with the program and I need it working with the given printer this week!
Even if you can give me a smallest tip, please, write me.
Thanks a lot!
|
|
|
|
|
Hello everyone,
My question is how to change the font color of slide.
I have Automated PowerPoint Using Visual C++ MFC,such as:
_Application app;
Presentations presentations;
_Presentation presentation;
Slides slides;
_Slide slide;
ShapeRange shaperange;
Shapes shapes;
Shape shape;
TextFrame textframe;
TextRange textrange;
Font font;
FillFormat fillformat;
ColorFormat colorformat;
ShadowFormat shadow;
if(!app.CreateDispatch("Powerpoint.Application", &e))
{
CString str;
str.Format("CreateDispatch() failed w/err 0x%08lx", e.m_sc),
AfxMessageBox(str, MB_SETFOREGROUND);
return;
}
app.SetVisible(TRUE); Presentations presSet(app.GetPresentations());
_Presentation pres(presSet.Add(TRUE));
Slides slideSet(pres.GetSlides());
_Slide slide1(slideSet.Add(1, 2));
// Add text to slide, by navigating the slide as follows:
// slide1.shapes(#).TextFrame.TextRange.Text
{
Shapes shapes(slide1.GetShapes());
Shape shape(shapes.Item(COleVariant((long)1)));
TextFrame textFrame(shape.GetTextFrame());
TextRange textRange(textFrame.GetTextRange());
textRange.SetText("My first slide");
}
{
Shapes shapes(slide1.GetShapes());
Shape shape(shapes.Item(COleVariant((long)2)));
TextFrame textFrame(shape.GetTextFrame());
TextRange textRange(textFrame.GetTextRange());
textRange.SetText("Automating PowerPoint is easy\r\n"
"Using Visual C++ is powerful!");
font = textrange.GetFont();
font.SetName("Comic Sans MS"); //Set the font name.
font.SetSize((float)48);
}
Now the question is how to change the font color????
Help me,please!!
Thanks a lot!!;P
cengyikun
|
|
|
|
|
Hi everyone, I am a new comer.
I want to ask if it is possible to write a directsound application without using GUI such as window dialog and MFC? Because I found that every sample provided by the DXSDK is written with window dialog? I wonder if I can create a application by using "Console Application".
Thank you everyone!!;)
|
|
|
|
|
There is no reason why you could not take appropriate functions from the examples and implement them in a console based application if that is what you want.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
But I encounter the following errors when I build the application:
fatal error C1010: unexpected end of file while looking for precompiled header directive
I am using .Net platform and creating this project by choosing the C++ console application.
Below is my code:
#include "stdafx.h"
#include "dxstdafx.h"
#include <commdlg.h>
#include <dsound.h>
int _tmain(int argc, _TCHAR* argv[])
{
HWND hDlg;
CSoundManager* g_pSoundManager = NULL;
if (FAILED(g_pSoundManager->Initialize(hDlg,DSSCL_PRIORITY)))
{
printf("FAILED");
}
return 0;
}
Since I am using console application , I don't know what to put for the HWND variable for the Initialize function.
And I found that the problem only exist when i add the DXUT.h, DXUT.cpp, DXUTsound.cpp, DXUTsound.h provided by the DXSDK sample.
Which .cpp or .h should be added to succeed?
Thank you for replying.
|
|
|
|
|
You need to disable precompiled header for the file who generates the error:
in the workspace, left click on the concerned file, then choose Settings -> C/C++ tab, then choose 'Precompiled Header' category and select 'Not using precompiled header'.
In fact this for VC6 but it must be something similar in .NET.
|
|
|
|
|
Thank you for your reply but I still can't build it successfully.
Can you tell me what must I do to start programming direct sound with console application, such as which .h files should be added.
Thank you.
|
|
|
|
|
Sobero wrote:
Thank you for your reply but I still can't build it successfully.
Yes but what is the error ?? Why can't you build your application ?
|
|
|
|
|
This is my code now:
#include "stdafx.h"
#include "dsound.h"
int main()
{
CSoundManager* g_pSoundManager = NULL;
return 0;
}
error C2065: 'CSoundManager' : undeclared identifier
error C2065: 'g_pSoundManager' : undeclared identifier
I have added the dsound.h in the solutino explorer, and link the dxsdk include and lib folder to the project.
Is the project still missing some .h or .cpp?
Thank you very much!
|
|
|
|
|
Where is the class CSoundManager declared ?
You have to include this file in the main file
|
|
|
|
|
Now, I have included the .h and .cpp files into the workspace.
However, the new added files cause the following error:
Capture fatal error C1010: unexpected end of file while looking for precompiled header directive
I have set the corresponding file to not use precomiled header,
but this cause the link error:
Capture error LNK2001: unresolved external symbol _IID_IDirectSound3DBuffer
What's wrong with my code?
#include "stdafx.h"
#include "dsound.h"
#include "dxstdafx.h"
#include "DXUTsound.h"
int main()
{
CSoundManager* g_pSoundManager = NULL; return 0;
}
Thanks again!
|
|
|
|
|
Did you clean then recompile after you change the project setting not to use pre-compiled headers?
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Walliams (Little Britain)
|
|
|
|
|
I have tried it but the problems still exist.
Maybe I send my project to you to see what are the errors.
|
|
|
|
|
Make sure also all the required libraries are included in your project (for example the library where _IID_IDirectSound3DBuffer is defined) !
You have to add these files in 'Project -> Settings' / 'Link' Tab and insert them in 'Object/library modules'.
This is probably why it throws the error: you included the .h files but the definition of the symbol is missing because it is defined in an external library (*.lib file).
|
|
|
|
|
Also , when i call the g_SoundManager->Initialize() function, I have to pass
the HWND parameter into this function. But I am using console application,
so, what should I pass for the HWND variable?
Console error LNK2019: unresolved external symbol "public: long __thiscall CSoundManager::Initialize(struct HWND__ *,unsigned long)" (?Initialize@CSoundManager@@QAEJPAUHWND__@@K@Z) referenced in function _wmain
Thank You!!
|
|
|
|
|
I think it is missing required Library file
-----------------------------
"I Think It Will Help"
-----------------------------
Alok Gupta
visit me at http://www.thisisalok.tk
|
|
|
|