|
Hi,
Im using MDI applcation.
In that I want to Hide the mainframe,but i want to display all child windows.
How can i do tht?
When i coded SW_HIDE for mainframe in InitInstance().I cannot get the childwindow.
Is anyother way possible to show child window without Mainframe?
Anu
|
|
|
|
|
You're attempting to use the framework in a way for which it wasn't intended. While you may in the end get the results you're looking for, in all likelihood you won't; you will probably keep running into issues where the framework is doing something that's incompatible with your scheme. The reason is simple - like I said, you're trying to use the framework in a way for which it wasn't intended.
Typically, when you run into a situation like this, your code will get uglier and uglier as you try to force the framework to your purpose. The ugly code is trying to tell you something - you need to rethink your approach to the problem. Why on earth do you want child windows all over the place but no mainframe? (Don't answer - I'm really not interested in debating the wisdom of your scheme.)
The bottom line is this. If you're going to use MFC, you're going to be a lot better off if you go with the flow and stop trying to force the framework to do something it wasn't designed for. You would be better off finding a framework that supports the architecture you're trying to implement.
[edit]
Grammar fixes.
[/edit]
L u n a t i c F r i n g e
modified on Friday, January 8, 2010 10:42 AM
|
|
|
|
|
In VC2010, there's a c++ app wizard that lets you create multiple top level windows - maybe that's what you want?
Iain.
ps, In VC6, I know of no whay to do what you're asking, especially if you want to show and then hide the CMainFrame.
I have now moved to Sweden for love (awwww).
|
|
|
|
|
Hi I just came across a function like
void (int a, int b,...)
{
//code
}
I assumed it as variable argument..But am I correct? If yes, how does it work exactly?...
-----------------------------
I am a beginner
|
|
|
|
|
What about documentation [^], [^]?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
hrishiS wrote: I assumed it as variable argument.
Your assumption is correct; see here[^] for documentation on how to implement this feature.
|
|
|
|
|
Hi to All,
I want to create a sine-wave like the one in (Windows Task Manager->performance Bar)..which should be moving depending upon some input.....
Please give me some hints
-----------------------------
I am a beginner
|
|
|
|
|
Could you be a bit more explicit ? What do you mean exactly by creating a sine wave ?
Do you want to display some signal on the screen ? Are you looking for a kind of chart control ? If yes, take a look at my sig.
|
|
|
|
|
Thanks for the reply
I know my questions is not specific.
I am just doing this to just to learn.I am a VC++ learner. when i was looking at the windows task manager performance tab, it strike my head to create something like that, ...since then i am breaking my head....I guess you can assume just drawing a signal....
-----------------------------
I am a beginner
|
|
|
|
|
If you want to learn how to do something like that, the easiest way is to look at the code of another example[^]
|
|
|
|
|
thanks
I will go through that and if u dont mind, i will get back to you for further doubts..
-----------------------------
I am a beginner
|
|
|
|
|
Hi All,
I have to call php script from my vc++ code, i have done this with java script and vb script through msscript.oct but i dont have any idea that how can i do the same with php script, if someone has any idea then please suggest me.
Thanks A Ton
Ash_VCPP
walking over water is just knowing where the stones are.....
|
|
|
|
|
What exactly do you mean by "call php script"? As far as i know, java-script and vb-script are usually client-side scripts while PHP is server-side. Do you mean you have the php script on a web server and you want to execute it and get the result thorough http (to which i might have an answer) or you want to execute a php script "within" your own application, something like including a php interpreter inside your executable or such (to which i don't have any answer to)?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
yes i am actually looking for the second logic of yours.
Thanks A Ton
Ash_VCPP
walking over water is just knowing where the stones are.....
|
|
|
|
|
Hmm, you got me there sadly, look around the Zend[^] site, maybe they have something you can use...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Sorry if this is kind-of long... the first few lines basically contain the question, the rest clarify what I really need. Feel free to read as much as you have time for.
Does anybody know a good tutorial on programming applications with multiple entry points in C++?
I am designing an application in MSVC 2008 Express that will interface with an AS/400 system and process scripts to either feed data, extract data by reading the screen, or do custom tasks. I was planning that it could be a stand-alone program where the user loads a script and it runs, or it could be a liason between Excel and the AS/400 via COM. I was also thinking that double-clicking a file (say, on the desktop or in Windows Explorer) could add the file to the process queue, and that if the program is open I could also add a file to the queue by putting the file into a particular directory. (I think I have that part covered by the filesystemwatcher class.)
So, my questions are thus:
1. How can I design a program where if the user clicks on the icon while the program is already running, the spawned copy will recognize that the program is already running and transfer control to a particular routine in the original instance? I know it can be done because there are programs that do it. What I am asking is, in effect, how do I make it so that if the user double-clicks on an icon while the program is running, instead of opening a new instance it simply brings the user to the instance already running? (And still checks the parameters being passed in, so like if I drag a file into the icon it will be recognized?)
2. If I program a COM library of functions for Visual Basic for Applications to use to control basic tasks in the program remotely, such as querying which file is being processed or changing the priority of a particular task to be run, how do I work it so that if the program isn't running yet and Visual Basic encounters a COM command, it doesn't crash? I was thinking of making a "check if the program is open" command... which I suppose would need the program to be invoked, but only the COM portion, and return a status of if the program is running or not, then close. (Or would I want it like a TSR that would keep running in the background to handle other such events?) How would I do that?
I can see that in any case there will have to be some sort of central holding place in memory to show if the program is open or not... but if I used the registry then if the program doesn't properly shut down it will still show as being open, even after shutting down the computer and rebooting. And there would probably also have to be somewhere a pointer or handle of some sort to the original thread.
Any ideas?
Thanks.
-Dan
|
|
|
|
|
let me try and give an answer to (1). I beleive you need to look for (and there are plenty around) a SingleInstance Class to add to your application. When the app initialises it creates an instance of the Single Instance Class, which creates a system wide Mutex. If you attempt to start a second copy of the program, it runs through the same code, but the Mutex already exists - so it fires a 'bring to foreground' event.
There are some good single-instance classes around, I'll try and find the one I use and post back.
Does that sound like it answers (partially perhaps) your 1st question ?
update - this is once such case CSingleInstance - Single Instance Apps[^] Im not sure if its the one I use - I also use minimise to tray, and when the user attempts to start another copy it reactivates it from the tray ..
'g'
|
|
|
|
|
Ans 1:
Check the article Limiting an application to a single Instance - the MFC way[^]
Ans 2:
There are some other ways to notify other application that your application is running, like creating a name Mutex. Also you can find out whether your process is running or not by enumerating process, or trying to find your window using the "FindWindow" function. How ever I think Mutex is the easiest way.
|
|
|
|
|
Dan Senior wrote: How can I design a program where if the user clicks on the icon while the program is already running, the spawned copy will recognize that the program is already running and transfer control to a particular routine in the original instance?
See Avoiding multiple instances of an application[^] by Dr. Joseph Newcomer.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Thank you... I will look into these ideas, they seem to be what I am looking for as far as not opening the application twice. I will have to play around and see if I can do these and still read the command line parameters passed in... so if I drag a file into the icon it will recognize the file and add it to the queue in the instance that is already running.
As far as #2 with the COM object, I may be able to extend the concepts from #1 to cover #2 as well, I will have to experiment and see what I can do. I still need to see how to make a COM object, most of what I have looked up is just about using COM objects, not about being a COM object.
-Dan
|
|
|
|
|
Maybe uneeded ideas but
- if the users would drag the file to your program instead of doubleclicking on it, you would not have the problem of multiple copies. Then the file is made known to your program by a drop-interface.
- if you could make a small program that copies file(s) to a folder you could use winAPI- functions findfirstchangenotification()/FindNextChangeNotification() to watch this folder with another program. Your basic commands then could also be transfered as files to the folder by the small program, and you could check then if the file(s)/commands sent are processed (because the other program moves them to another folder after processing). When not processed within time the other program is not running (or just too slow) but everything is queued..
That's what came in my mind reading your questions...
Rozis
|
|
|
|
|
Actually, the original draft for this program was very similar to that... it was going to be a macro in Visual Basic Script that would run in the AS/400 client window... and the original way it was going to work was that Excel would generate the file (via Visual Basic for Applications) and copy it into a specific directory. In the meantime, the AS/400 VB script program would cycle through checking for the existence of files (they would be named like file1, file2, etc. but there would also be a particular filename the user could save a text file as and drag into the folder and it would look for that too). When it would see a file, it would process it and then move into a "finished" folder and add to a log that it did it and then move back to looking for the next file in sequence and if there wasn't a #2 or #3, etc. it would go up to about five past where it was and then start over at 1.
When I was working on designing the actual scripting language, I quickly realized that the program was blossoming into something that would be unweildy to run in BASIC, so I moved to C++ and a whole world of options opened up. When I started thinking how does a regular application work, I decided I want to try these other methods in addition. (It might still do the directory scan thing too.) Plus, having a stand-alone program frees up Excel and the AS/400 window because currently I do have Excel pushing into the AS/400 but I can't use either system until it is done.
I will start by first just having a FILE/OPEN or right-click on the queue and choose add... but in thinking ahead because changing structure sometimes requires rewriting the whole program, I'd like to have an idea of how to structure from the beginning so that I don't have to rework the program.
Good ideas, though... I will play with what I have seen so far and if I can have six or seven ways of opening the file, all the more useful for anyone who will be using it later. I just want to make it easy to pick up and use.
|
|
|
|
|
hello i tried to link this two file:
#include<list.h>
template <class T>class hash{
public:
list<int> *l;
int m,n;//k is the entry and m is number of slots and n is the size of our array
hash(){
l=new list<T>[n];
n=m=0;
}
hash(int n1,int m1){
n=n1;
m=m1;
l=new list<T>[n];
}
int hashfunct(T k){
return k % m;
}
void print_hash (){
for(int i=0;i<n;i++)
while(!l[i].empty()){
cout<<"l["<<i<<"]="<<l[i].front()<<" ";
l[i].pop_front();
cout<<endl;
}
}
list<T>* add_to_hash(T k){
int key=h.hashfunct(k);
l[key].push_front(k);
return l;
}
};
and the main program:
#include<iostream>
#include<stdlib.h>
#include "/home/sajad/src/ds/test/hashfunctions/hash.h "
using namespace std;
int main(){
int n;
int m;
cout<<"please enter n(number of entries):"<<endl;
cin>>n;
cout<<"please enter m(the dividisor number,must be near n):"<<endl;
cin>>m;
int a[n];
for(int i=0;i<n;i++)
a[i]=0;
hash<int>h(n,m);
cout<<"please enter n numbers:"<<endl;
for(int i=0;i<n;i++){
cin>>a[i];
h.add_to_hash(a[i]);
}
cout<<"after hashing:"<<endl;
h.print_hash();
return 0;
}
the address of hash.h is completely true but i face this error:
[sajad@sajad hashfunctions]$ g++ my\ hashing.cpp
my hashing.cpp:4:57: error: /home/sajad/src/ds/test/hashfunctions/hash.h : No such file or directory
my hashing.cpp: In function ‘int main()’:
my hashing.cpp:16: error: ‘hash’ was not declared in this scope
my hashing.cpp:16: error: expected primary-expression before ‘int’
my hashing.cpp:16: error: expected ‘;’ before ‘int’
my hashing.cpp:20: error: ‘h’ was not declared in this scope
my hashing.cpp:23: error: ‘h’ was not declared in this scope
[sajad@sajad hashfunctions]$
can anyine help me?
thnx.
|
|
|
|
|
Well, the error message is actually very clear:
the path
/home/sajad/src/ds/test/hashfunctions/hash.h
is wrong.
BTW Why don't you use relative paths?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
i also used #include "hash.h" but yet this takes error!!!
modified on Friday, January 8, 2010 3:58 AM
|
|
|
|