Visual C++ :: Call Sub From MdiForm In Form1?
Jun 24, 2013
I have MdiForm and Form1 as a child Form1 has a menu 'mnuClear' Sub mnuClear_Click MdiForm a button Clear.
Can you click on the button from MdiForm call sub mnuClear_Click in Form1 Sub mnuClear uses local variables and can not be moved to the module ...
View 1 Replies
ADVERTISEMENT
May 20, 2012
I've got a calendar in Form 1 in my code, and buttons in Form2. I need these buttons to send codes for this calendar in Form1. How may I make these work? My friend told me to do a function as a new class, but I'm not sure how can I do this.
View 5 Replies
View Related
Sep 20, 2012
I have a window I am opening from the parent Dialog by using DoModal:
CMyDlg dml;
dml.DoModal;
When the window opens I want it to run a function on open. Lets just for example say copy files and show a progress bar. Where can I put the function call so that when DoModal is called that function will execute?
View 13 Replies
View Related
Sep 22, 2012
I'm working with a cross-platform library which defines a function to obtain function addresses from a shared object (i.e. a DLL on Windows). Here's my modified version of the function which works (albeit only on Windows of course):-
Code:
typedef void (*SuilVoidFunc)(void);
/** dlsym wrapper to return a function pointer */
static inline SuilVoidFunc
suil_dlfunc(void* handle, const char* symbol) {
return (SuilVoidFunc)GetProcAddress((HMODULE)handle, symbol);
}
Now, here's the original (cross-platform) version which is giving me a run time error on Windows:-
Code:
typedef void (*SuilVoidFunc)(void);
#define dlsym GetProcAddress
/** dlsym wrapper to return a function pointer */
static inline SuilVoidFunc
suil_dlfunc(void* handle, const char* symbol) {
typedef SuilVoidFunc (*VoidFuncGetter)(void*, const char*);
VoidFuncGetter dlfunc = (VoidFuncGetter)dlsym;
return dlfunc(handle, symbol);
}
That original version fails at the final return line. The error message says "The value of ESP was not properly saved across a function call".
I'm assuming there's a problem with the declaration of VoidFuncGetter (i.e. it'll assume that the caling convention for GetProcAddress() is cdecl when in fact, it's stdcall). What's the most elegant way to fix this and still keep cross-platform compatibility?
View 1 Replies
View Related
Jan 16, 2013
How can I call a dialog , which is present in a seperate Win32 resource DLL .
View 4 Replies
View Related
Dec 23, 2012
I have two problems with the code below:
1. I cannot find a header file to #include that has the sleep function prototype.
2. When I add my own sleep function prototype, I get an unresolved external reference error (for _sleep, not sleep).
What must I #include to get the sleep function prototype? What lib must I include in the linker configuration to resolve the external reference? (I suspect that if I #include the correct header file, the second question might become moot.)
The "man page" at [URL] .... says the header file is <WinBase.h>. But #include'g only <WinBase.h> results in compilation errors.
A response marked "answer" at [URL] ..... says <windows.h> [sic]. #Include'g only <Windows.h> does eliminate the compilation errors.
But apparently that does not bring in the sleep function prototype. Neither does also subsequently #include'g <WinBase.h>. (Which seems to be #include'd by <Windows.h> anyway.)
But even with my own function prototype shown below, I get an unresolved external reference for _sleep. Is that a symptom of my problem: my sleep reference is changed to _sleep? If so, how can avoid that?
According to "man page" (see link above), the external should be resolve in kernel32.lib. And kernel32.lib does appear in the "Additional Dependencies" list under Configuration Properties Linker Input.
Since I am not using C++ features, I tried setting "Compile as C" under Configuration Properties C/C++ Advanced, to no avail.
My code....
#include "stdafx.h"
#include <stdlib.h>
#include <time.h>
#include <Windows.h>
void sleep(DWORD msec); // added later
int _tmain(int argc, char* argv[])
[Code] ....
View 3 Replies
View Related
Oct 21, 2014
I am trying to display the following arrays.
int a[4]={5,9,2,10}
int b[3][3]={1,2,3,4,5,6,7,8,9}
int c[2][3][2]={1,2,3,4,5,6,7,8,9,10,11,12}
Using these call statements
Display (a,4);
Display(b,3);
Display(c,2);
I'm not sure on how to put this all together but this is what I have so far.
Code:
#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
} int a[4] = {5,9,2,10};
Display(a, 4);
[Code] .....
View 4 Replies
View Related
Jan 19, 2013
Is there some document, that describe the sequence of actions, that result in displaying of a Dialog Window from a .DLL.
One important detail - the Dialog Window is created via resource/toolbox inteface.
Below is code from some example (which works), that displays simple window (with client area inside it).
In this code the window class is ctreated inside of application class.
Here is extract from application class:
Code:
class CMyWindow : public CFrameWnd {
CStatic* cs;
public:
CMyWindow();
};
CMyWindow::CMyWindow() {
Create(NULL, L"MyWindow", WS_VISIBLE, CRect(0,0,200,200));
[code].....
Where is my mistake ?
View 14 Replies
View Related
Jul 14, 2013
I am trying to create a loop to call in the entries from the text file named Set. The entries of Set.txtare :
1 2 3
2 4 5
and so on .. (64 such combinations)[/CODE]
It basically means the first combination for testing is 1 2 3 and next has to be 2 4 5 and so i have 64 such entries defined in set
My test files are located in D://data// and are named tst_data1 to tst_data64.
I created a loop for test set but its incorrect
Code:
// loop for test samples
char basefilename[] = "D://data//";
char , testFilen[160], numiChar[10];
for (int i=1; i<=64; i++) {
strcpy(basefilenme, "D://data//");
strcat(testfilename, Set[]);
[Code] .....
How can i call the Set .txt and how to define it.
View 1 Replies
View Related
Dec 22, 2012
I am making an application that processes multiple files (typically > 500) through a command prompt call. The way I start the command prompt app is by looping using a call to CreateProcess for each file that is to be processed. It works fine, except that I somehow loose 'connection' to my app so that
1: Windows says that the app. is 'Not Responding'
2: The Cprogress bar in my app is not updated before all files have been processed, even though there is a CreateProcess call and a Cprogress.StepIt() from the app for each file that needs processing.
I somehow suspect that the CPU gets swamped... I do not want that Windows starts to say that my app is 'not responding' and I want my Cprogress dialog bar to update according to the number of files that are progressed through.
I wonder if multithreading is the OK way to go instead of just kicking of series of CreateProcess calls? Maybe my CreateProcess is not ending correctly? It seems as if my app is 'not regaining control' before very late. The app never crashes though.
My CreateProcess code is listed below, maybe there can be a problem with it, or maybe I should do things in a different way? My app basicaly works as it never crashes, but with above mentioned problems it is NOT a pro solution...
void CMultiFilerDlg::ProcessFile(CString pdfFile) {
int i=0;
DWORD ProcID;
// Open file in text mode:
STARTUPINFO si;
PROCESS_INFORMATION pi;
char cmdArgs[2052];
[Code] .....
View 6 Replies
View Related
Oct 30, 2013
You need to write a permute class that will take first and second strings to rearrange letters in first, followed by second. For example, if the first is “CAT” string and second is “MAN” string, then the program would print the strings TACMAN, ATCMAN, CTAMAN, TCAMAN, ACTMAN, and CATMAN. The first and second strings can be any length of string or a null.
The permute class uses a Note class as link list note to link all letters arrangement. The permute class has Note pointers, firstNote and lastNote, to point to the beginning and ending Notes of the link list as private data members. There are three other private data members (total, firstString and secondString) to store the total possible number of arrangements and strings pass into the class.
Write a driver to test the permute class to pass in any two strings of any sizes.
Other than mention in the following, you can add more classes, functions, and private data members to this program.
Note class:The Note class needs to have two private data members and a constructor. The two private data members are data and p pointer. The data’s data type is string and p pointer is Note. The Note class constructor has two parameters, one is string and the other is Note pointer.
Permute class:The Permute class has five private data members (*firstNote, *lastNote, total, firstString and secondString). The firstNote and lastNote pointers are point to Note. The total has integer data type. The firstString and secondString have string data type.
There should have at least three public member functions, Permute, permutation and print. The Permute function is the constructor which takes strings to initialize the private data members. The permutation function does the recursive call to arrange the strings and setup the link list. The print function will print out the private data member information.
Driver file:The driver file should declare a Permute eight elements pointer array. Instantiate eight Permute object with the following eight set of data and assign the object to the pointer array. Use a repetition to call the object’s print function to print out the private data member information. If the total of the permute private data member is less than 100 then print out the permutated letters four in a row, otherwise print out 9 in a row.
first = "", second="",
first = "", second ="CATMAN",
first = "C", second ="ATMAN",
first = "CA", second ="TMAN",
first = "CAT", second ="MAN",
first = "CATM", second ="AN",
first = "CATMA", second ="N",
first 1 = "CATMAN", second ="";
View 3 Replies
View Related
Mar 19, 2013
I searched the web for error: C3867... and the discussions where murky or obscure.
My code excerpt is:
#pragma once
#include <windows.h>
#include <stdlib.h>
#include <process.h>
void PutUpfrmIO(void *);
namespace WordParsor {
[Code] .....
I get the generic message:
error C3867: 'WordParsor::Form1::PutUpfrmIO': function call missing argument list; use '&WordParsor::Form1::PutUpfrmIO' to create a pointer to memberc:userskingc++wordparsorwordparsorForm1.h... and the suggestion fix generate another error.
One person suggested the gcroot<> object wrapper... but I do not know how to modify/declair the function or its argument type.
View 2 Replies
View Related
Apr 25, 2014
What is Function call Overhead and Function Call Stack?
View 2 Replies
View Related
Oct 10, 2013
so here is a basic program i wrote i am thinking of writing a currency conversion program that does multiple conversions and i was thinking it is possible to do something like this couldnt i call them after i write them as functions
usdtoeuro()
usdtokuna()
how would i go about doing that? or can you point me to anything?
Code:
#include <stdio.h>
int main()
{
[Code].....
View 2 Replies
View Related
Jan 9, 2015
I have decalred a password function which accepts an array as parameter but while compiling, it's showing an error wherever I have called it.
void password(char a[100])
{
if(::q==1) { cout<<"
Enter the master password : "; goto ENTER; }
[Code]....
Wherever I have called this function it's showing an error: "Call of nonfunction." One of the examples of the errors is below:
::q=1;
password(master_password);
//Both 'q' and 'master_password' being global variables, and master_password being array of size 25.
View 7 Replies
View Related
Jan 12, 2015
I wrote a program which detects a pattern in an array then returns a valve (x) for each time it does. now i tried to call function patt in main so that i can print x but it doesn't let me do it.
#include <stdio.h>
int patt(const int SIZE, char str[], int i, int c);
int main(void) {
const int SIZE=21;
char str[SIZE]={'1', '0', '1', '1', '0', '0', '1', '0', '1', '0', '1', '0', '0', '0', '1', '0', '1', '1', '0', '1'};
int i, c=0;
[code].....
View 14 Replies
View Related
Mar 5, 2013
what is the call by value in function??
View 1 Replies
View Related
Mar 5, 2013
This is the error I keep getting, but I'm not sure how to resolve it.
assignment7.cpp:11: error: no matching function for call to 'Time::display() '
Time.h:18: note: candidates are: void Time::display(int, int)
Code:
#include "Time.h"
int main() {
Time tm;
tm.set(12,53);
dt.display(); //Should display 7/4/1776
[Code] .....
View 2 Replies
View Related
Feb 16, 2013
I want to write a function and be able to call it during execution (say during a while(1) loop). Is this possible without having to parse an input string to extract the function and parameters I need or is that the only way?
View 1 Replies
View Related
Apr 17, 2013
So I know that I can call a program by system("prog.exe"), but what do I add in when I want to pass a parameter?
View 2 Replies
View Related
Feb 27, 2014
how to call the methods of the class.I have an object call v which is an array and I don't how to call the methods of the class. The error is here:
v.readDates(v[a]);
#include "Date.h"
#include <iostream>
using namespace std;
int main(){
int a;
cout << " HOW MANY DATES DO YOU HAVE? " << endl;
[code]....
View 3 Replies
View Related
Sep 5, 2013
My program is crashing when I'm trying to call b = a. What has me confused is that when I call c = d = b, it all works fine.
I actually think I see it now that I posted this. In operator= I'm changing the size, but I'm not changing the size of the array that it's pointing to correct? I'm keeping it as 'p = new T[size]' rather than changing it to 'p = new T[x.size]' correct?
#include <iostream>
#include "Array.h
int main() {
std::cout << "creating Array< int > object a ...
[code]....
View 13 Replies
View Related
Oct 15, 2013
i think my function call is not working and i dont know how to fix it. Basically i want it to output my getstudent function and once i get the information i want it to output with the displaystudent.
#include <iostream>
#include <string>
using namespace std;
void displayStudent(Student x) {
cout << x.first << ' ' << x.last << endl;
cout << x.id << endl;
[code]....
View 6 Replies
View Related
Jun 1, 2013
no matching function for call to `getline(std::string&, char&)' Why is this error occuring?
My Aim is to copy each character or integer to an array
MY PROGRAM:-
#include <fstream>
#include <iostream>
#include<conio.h>
#include<string.h>
[Code].....
View 2 Replies
View Related
Jan 7, 2015
I would like to get the this pointer by call by reference. Is this possible? I hoped to get it with this code, but it doesn't work:
Code:
"cpp"]class DemoClass {
public:
DemoClass();
int x;
void setParam(const DemoClass ¶m){
param=this;
[Code] ....
I get always the error code "C2678". But I don't understand how I should change my code to avoid this.
View 4 Replies
View Related
Feb 25, 2015
#include <cstdlib>
#include <iostream>
using namespace std;
struct height {
int feet, inches;
[Code] .....
I'm getting a succeed when i try to compile but my grow function is throwing me an warning that the + and - don't work in regards to grow function.
Basically i want it to grow a certain amount of inches specified and format the foot and inches if it goes over a foot. Can i not just add 1 to feet as it's an int? The same goes with inches.
View 3 Replies
View Related