Visual C++ :: How To Pass CStringArray From Application To DLL
Feb 11, 2013
I passed the CStringArray to dll & wrote the String in a file.
The error File: array_s.cpp, Line No: 420 was occured when i close the .exe file.
For your reference:
Code:
Function Declaration in DLL :
DECLDIR void SetParName(CStringArray& ParName);
Function Definition in DLL :
DECLDIR void SetParName(CStringArray& ParName){
ParName.Add("X1");
ParName.Add("X2");
[Vode] .....
My doubt is, CStringArray items are allocated in the DLL. So, when i release the CStringArray object in the application. Is it can release memory that are allocated in the DLL ?
View 1 Replies
ADVERTISEMENT
May 9, 2012
I want to create an application that starts an application and passes input to that application. I know how to start a process using the classes in System.Diagnostics, but I don't know how to pass data to the process.
For example, and this is just an example, I would like to be able to automatically start an application that requires a username and password and automatically enter the username and password. Of course, that might open the door to security vulnerabilities, but that's not the point of the exercise.
How to implement the functionality I described? Is there a general way to go about doing this or does it depend entirely on the idiosyncrasies of the application in question?
View 2 Replies
View Related
Jan 27, 2014
I'm creating simple console application using Code::Blocks to allow me to pass parameters from other application to replace string within text/registry file before execute the registry merge. Passing parameters to console already success. Now I only have problem with reading file. Example of first line in the registry file is as below.
Windows Registry Editor Version 5.00
However when read into string and output to console using 'cout', it will be show as below with spaces in between.
W i n d o w s R e g i s t r y E d i t o r V e r s i o n 5 . 0 0
Below is my code.
ifstream f("install.reg");
string s((istreambuf_iterator<char>(f)), istreambuf_iterator<char>());
cout << s;
View 6 Replies
View Related
Mar 12, 2013
i am trying to create a form app with multiple forms. there is a form i'm using as "search". i want to take the value of the textbox in search-form and pass it to another form which shows the result of the search. i've tried to include search-form.h in the form of the result but it returns an error.
Code:
String ^ key;
key = searchbox->Text;
std::string ks = marshal_as<std::string>(key);
ks=ks+".bin";
ifstream sfile(ks);
if (sfile) {
PatInfo ^ form = gcnew PatInfo;
form->ShowDialog();
} else {
MessageBox::Show( "Please try again.");
}
to conclude, i want the form PatInfo to open an receive the "ks" var.
View 4 Replies
View Related
May 5, 2013
Visual C++ 2010
I'm using SFML with Visual C++ and need to pass a handle to a function. I've tried to find this on the web with no luck.
The handle happens to be a sprite defined as: sf::Sprite Numbers(MyNumbers);
Now I want to pass "Numbers" to a function.
-
-
getFrame(Numbers);
-
-
???? getFrame(??????) {
Numbers.SetSubRect(sf::IntRect(0,0,63,63));
return ????
}
How do I do this?
View 1 Replies
View Related
Feb 12, 2014
I need to pass a variable to a dialog box.
Code:
Doc* pDoc;
Dialog dlg;
int input = dlg.DoModal();
When I call dlg.DoModal() I need to somehow pass the pDoc into the dialog box. Everything I need the variable for is taking place inside the oninitdialog function. Is there anyway to pass the variable to that function?
View 2 Replies
View Related
Jul 24, 2014
[URL]
class CMyclass
{
public:
CMyClass(BOOL bUseWhichMemManager);
void* operator new(size_t);
void operator delete(void*);
};
I create two memory manager called CMemManager1 and CMemMangaer2, using different algorithms to allocate buffer. Now I want to control which memory manager to be used, when calling new.
I try to add a parameter bUseWhichMemManager to the constructor, but in overrided new function, there are no way to access the parameter. Is there a way to pass more parameters to new operator, such as:
void* operator new(size_t size, BOOL bUseWhichManager);
View 1 Replies
View Related
Feb 28, 2013
I want to pass some parameters to a dialog. I am trying to pass a struct as LPARAM in CreateDialogParam. How to access this structure from ONOK for example?
Code:
struct DlgParam{
std::wstring IEDllPath;
CString folderName;
};
[Code] .....
View 7 Replies
View Related
Nov 17, 2014
I have some trouble with DLL. I created a dll with function
double square(const double * args)
and then in my application defines
typedef double (*MyFunct)(const double *args);
I use LoadLibrary and GetProcAddress to get the function address and cast it to MyFunct. Everything works fine except that when I pass a double *, for example 0x08800350, to the DLL function, the argument becomes totally something else, for example, 0x0aa00460.
I have no clue what happens to the argument value.
View 3 Replies
View Related
Feb 5, 2013
I am wondering if I have the following parameter to pass in to a function
Code : void Load(std::wstring filename);
This statement is wrong.
Code : Load("DataMesh.x");
I don't want to pre-declare a variable. How do I directly pass a wstring (literal) to this function.
View 2 Replies
View Related
Feb 7, 2013
I have a question about to run an MFC dialog based C++ application from console: if I run my application from console, I see the application start and the console immediately back to prompt. I need that console wait the application exit before show me the prompt again. I tried on Visual Studio 6, 2005 and 2010 but the behavior is the same.
View 3 Replies
View Related
Jun 23, 2014
I want to achieve such an efect like - one view which takes all MDI area and some views which arelike non modal dialogs
Two Child frames will be correct? one for "big" view which will be always visible and second for a "smal" views
View 2 Replies
View Related
Nov 27, 2014
i have a project where i create a dice game, the user rolls 2 dice and the computer roles 2 dice. the player that wins 3 out of 5 rolls wins the game. I have completed the requirements, but i wanted to create a pass by value function for "void Dice()", I'm not too sure how that works?
Code:
#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
//creating my variables and their values
int compinput;
[Code] .....
View 5 Replies
View Related
Mar 23, 2013
We have developed MDI application on 17 inch monitor in VC++ 2010 MFC. But now management wants application to run on 10 inch laptop.
Application does not fit,it goes out of screen. How to fit application on smaller screen
View 1 Replies
View Related
Jan 15, 2014
I have a HTML code and i need to developing a form application.
issue: i have a html code and a database table , how to put this together with code and link them and peu them on server ...
View 3 Replies
View Related
Feb 4, 2014
I have a SDI application. I created a method OnClose to handle ON_WM_CLOSE of CMainFrm. This onclose() function calls a method in cmyview.cpp. Here, I created a thread that calls global function and from this function it calls another function in cmyview.cpp. At certain condition my application should close at here, I used postmessgae(WM_CLOSE (or) WM_DESTROY). I am having an error as object reference not set on postmessage(WM_CLOSE) it is going to afxwin2.inl page where exception occurs.
Below is code snippetHere, either j or k will only be true depneds on user input)
MainFrm.cpp:
void CMainFrame::OnClose()
{
CMyView* pview = (CMyView*)((CFrameWnd*)AfxGetMainWnd())->GetActiveView();
pview->method1();
}
[Code]...
View 3 Replies
View Related
May 15, 2014
I have a Win32 C++ application which works pretty well, but I don't like the GUI and I want to replace it with one designed graphically, a la Windows Forms. What is the best strategy to port my code? I tried creating a new Windows Forms C++ application and got pretty far with it, but was stymied when trying to call my unmanaged functions on a button press. If I can't use Forms to add a GUI without completely rewriting the program, what's my best bet?
View 14 Replies
View Related
Jan 16, 2013
In a typical MFC application I use SetRegistryKey(_T("My_Company")); to set the root registry entry for my application. The MFC application however creates an entry by the name of executable where it stores all the settings of that application. I don't want that because we often change the name of executable and I want it read registry from the same set location. As example if my application name is Calculator.exe and Calculator_debug.exe it creates two different registry settings.
My_CompanyCalculatorsettings
My_CompanyCalculator_debugsettings.
How can I stop that?
View 1 Replies
View Related
Apr 17, 2015
I am developing a MDI application that will contain a RibbonBar and a Properties Pane window. The MDI documents are not tabbed. I am finding that when I try to move the client window around, it gets clipped by the RibbonBar and the Properties Pane window (shown in image). I know the client window cannot go outside the client area, but can the client window be on top of the ribbon bar and the properties pane window?
I am using VStudio 2008.
View 7 Replies
View Related
Nov 9, 2013
I am new in Visual C++ and I have to make an MFC application with "child" windows. Here is what i need to achieve - [URL] ..... As you can observe when you click on the cross of popup window or child window 2 both are closing.
View 2 Replies
View Related
Nov 11, 2014
I'm struggling with the pan gesture in a desktop application for my Surface Pro 2.
I simply want to pan (or "swipe" if you prefer) with two fingers, but it doesn't behave like I want it to. If I put two fingers on the screen and move them straight diagonally, I receive a series of client coordinates that are aligned in a vertical or horizontal direction. Only if I perform some circular motion, then it's suddenly possible to move diagonally and receive coordinates accordingly.
I've tried with MFC, by overriding CView::OnGesturePan. I've also tried with a sample project provided by Intel, that handles the GID_PAN message in WndProc to move a rectangle around, but with the very same result. The project can be downloaded from [URL] ... fordesktop.zip, so you can quickly reproduce the behaviour if you have a touch screen.
Code:
void GestureHandler::handlePan(HWND hWnd, GESTUREINFO gi) {
if (gi.dwFlags & GF_BEGIN) {
m_first.x = gi.ptsLocation.x;
m_first.y = gi.ptsLocation.y;
[Code] .....
I first thought it had to do with the points being too close to each other. I mean, if two points lies only one pixel apart, it can only result in eight different directions. But if I modify the code to only update "m_first" when the distance between the points are greater than some minimum distance, the points still keep being projected to a horizontal or vertical line relative to the first starting point.
View 1 Replies
View Related
Jul 31, 2013
I have created a MFC dialog based application. Now I want to implement such a functionailty that I will be closing my application through command prompt. And while closing of my application the ExitInstance() method of my application should get called. What is the command which I should put in the command prompt to close my application in such a way.
View 8 Replies
View Related
Jan 23, 2015
This code doesn't send parameters to mysql database vis WININET post, i see it send empty fields, what exactly could be the problem:
Code:
#include <stdio.h>
#include <windows.h>
#include <string.h>
#include <Wininet.h>
#define PAGE_NAME "gate.php"
[Code] ....
View 13 Replies
View Related
Jan 20, 2014
For my project I need to check whether my application instance is already running or not. I got the following code from Net ..
Code :
HANDLE mutex;
mutex = CreateMutex( NULL, TRUE, _T("MYAPPNAME"));
if ( GetLastError() == ERROR_ALREADY_EXISTS ) {
// There's another instance running. What do you do?
AfxMessageBox(_T("Application Already Exists"));
PostQuitMessage(0);
ExitThread(0);
return;
}
The code works fine .. but the code even works fine , even if I pass any string as a parameter to CreateMutex. E.g.
mutex = CreateMutex( NULL, TRUE, _T("QQQQ"));
How it is working fine ?
View 5 Replies
View Related
Apr 8, 2013
I am doing an project in SDI. I have two functions name sendtext(CString str) and displaytext(CString inr) both in different class. I have a pointer name pView to send the string str to function "displaytext". The problem is after some operations i get a text in str and i send that text to display text in the output screen i get the text and wen the second text comes to "displaytext" the former text disappears and the latest string only present. How can i display both the text in the output window on ClistCtrl class.
Code:
Void sendtext(CString str)
{
// do some operations
................
pView->displaytext(str);
}
void displaytext(CString inr) {
CListCtrl &ctlsde = this->GetListCtrl();
ctlsde.InsertColumn(1, _T("First "), LVCFMT_LEFT, 80);
int nItem;
nItem = ctlsde.InsertItem(0, inr);
}
View 14 Replies
View Related
Mar 26, 2014
I am just at the starting point of this subject. How do i add a video player to my windows form application in vc++?
Can I link youtube videos to that player to be played?
View 2 Replies
View Related