|
If you want to do it at run time, override the virtual function DoModal();
#include <afxpriv.h>
int CMyDlg::DoModal()
{
CDialogTemplate dlt;
if (!dlt.Load(MAKEINTRESOURCE(CMyDlg::IDD)))
{
return -1;
}
WORD nFontSize = 10;
TCHAR chFaceName[100] = "Courier New";
if (GetNewFontSize(....))
{
nFontSize = newsize;
}
if (GetNewFaceName(....))
{
lstrcpy(chFaceName, newfacename);
}
dlt.SetFont(chFaceName, (WORD)nFontSize);
LPSTR pData = (LPSTR)GlobalLock(dlt.m_hTemplate);
if (pData == NULL)
{
return -1;
}
m_lpszTemplateName = NULL;
InitModalIndirect(pData);
INT nResult = CDialog::DoModal();
GlobalUnlock(dlt.m_hTemplate);
return nResult;
}
|
|
|
|
|
I use a method similar to this with a highres app and it works great. On a highres monitor (2048 x 2560) I use 15pt font and on the second (1024x768) I use 10pt...
John
|
|
|
|
|
Hi all,
I'm new to C++ and am trying to write a kind of predictive text program where the text from a file will attempt to be predicted by the program. Atm I'm trying to get started by reading the text from the file a character at a time and having each character be displayed to the screen after a press of a key. I've managed to read the text and display it as a complete word but am having trouble reading and displaying it a character at a time. I've messed around with cin.get, cin.getc, cin.getchar etc and can't seem to get them to work correctly
Any help on how to go about doing this would be greatly appreciated, Thanks.
The short program below is how I read the text from the file and displayed it to the screen:
Note, to avoid the console window disappearing, you have to run it using CTRL+F5. If there is another way to stop it closing please let me know. I'm using MS Visual C++.NET btw.
=====================
#include <iostream>
#include <string>
#include <fstream>
using namespace std;
int main()
{
char buffer[256]; // Create 256 bit character array.
ifstream file_op; // Create an output stream variable.
file_op.open("mytext.txt"); // Open the text file to read from.
while(file_op >> buffer)
cout << buffer << endl; // Display complete text (complete word)
file_op.close();
return 0;
}
|
|
|
|
|
look in the help for getch(); you will need to include stdio.h.
|
|
|
|
|
Why not change buffer to be a single character?
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
A executable file which has compiled, How to insert it into IE?can you help me ,please tell me some about it,Thanks!
|
|
|
|
|
I believe your asking how to run an true exe (machine code) inside a browser. This is impossible for two reasons:
A) Browsers are not OSes they only display the contents of HTML pages and a few other formats. Additionally, a browser is not going to translate your code into code compatible with the visitors system.
B) Some plug-ins and scripts do allow for functionality similar to a program but they are intentionally made restrictive so that web authors cannot attack web surfers with malicious programs.
That being said, their are ways to write programs for browsers that are not true machine code. The most popular by far is Java code. This can be done through what are called Java Applets. The limitation to this is that each user will need to install your applet and accept it through a dialog that pops up when they go to your page if it contains code that could possibly harm the users computer. For a detailed explaination check out this site: http://java.sun.com/sfaq/
|
|
|
|
|
Thanks a lot!I find some web pages have a program such as realoneplayer,maybe i express incorrectly my idea,can you tell me how to do it ?
|
|
|
|
|
To do that you would need to create a plug-in for each browser that you would like to support. This is not a small task. Unless you absolutely need a plug-in (which isn't very likely) I would recommend making an applet. If you really want to make a plug-in for IE try this link:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnanchor/html/anch_webdev.asp
If you want to play music from a browser you can do that with an applet. In fact their are some already made that are very customizable and easy to use and free that may give you an idea of what is possible with an applet as far as Javas' audio capability. Here is a link to one that I use on one of my sites:
http://www.freedomaudio.com/
|
|
|
|
|
|
Hello,
I am developing a software of Arabic version using Visual C++.
I need to get the glyph outline of a string.
I used GetGlyphOutline() to do this.
However, I can't get the correct outline.
The arabic's char changed according to the next char. (to make them link together)
The following URL shows the different.
http://home.kimo.com.tw/chcnjg/index.html
The above block shows the correct result.
The below block shows the result I got.
Does anyone know how to solve this problem?
Or how to find the related data?
I try to solve this problem for a long time and failed.
This problem really made me crazy.
If you have any information, please tell me.
Thank you very much.
Best Regards,
chcnjg
|
|
|
|
|
Hello,
I have been working with Visual Studio .NET for about a year but I wanted to add Visual Studio 6 on my computer. Will a problem arise if I install it?
-Ryan M.
|
|
|
|
|
|
I downloaded a code that requires to compile it with version.lib.
// Remember: You must link version.lib to the project for this class to work !!
I am using VC++6. Can any body tell me how to do this?
Any help is greatly appreciated
|
|
|
|
|
|
a simple way (but not necessarily portable to non-MS systems (I only use VC++ versions) is to put a line like this in stdafx.cpp
#pragma comment(lib,"version.lib")
which will put a comment in the STDAFX.OBJ file to tell the linker to search that library.
Steve S
Developer for hire
|
|
|
|
|
Downloader and Install files from the WEB (Like the Windows Updates)
Hi everybody.
I'm trying to create a web application with C#.net or C++ like the (windows updates from Microsoft) to let the customer of our company download automatically our executables files from the web and also let the web app automatically the install those files on their computers.
If somebody has any idea of how to do it or any source code about it, I’d appreciate.
Thanks
Ali Hidalgo
|
|
|
|
|
I would suggest that you abandon the idea of doing it from your browser (the way that win update does). Just a few of the reasons that this is a bad idea are:
* Most network admins have disabled installation of the applet you would need for this.
* In order for the applet to install securely you would need to purchase a certificate from a certificate authority (a fairly expensive proposition considering the alternative is free)
* C++ is completely incapable of doing this unless you develop it using a plug-in (which is a very difficult way of doing such a simple thing). C# and Java are both too limited when ran as applets to make the possibly needed registry changes.
* Even if you got past all of this, it is still far more inconvienent for the user to go find your download section of the website than it is for them to select an option in the menu of the prog they are already using.
* An application can be setup to automaticaly check for newer versions without the user needing to bother with it.
The better way to handle this problem is by using either C# or C++ to write a seperate app that simply downloads the files into the correct directories and makes any registry changes needed.
This application will follow this basic program flow:
1. Check FTP server for newer version of the installation file. A good way to do this is to use a specific file naming convention and comparing that to a set of variables in the main app (in .NET apps this is already availible through the App object). These can be sent to the updater app via the command line, DDE or OLE (whatever you are most comfortable with).
2. If newer file is found, then download.
3. After download completes close any running instances of the main app and run the install app you just downloaded.
If you don't want the user to see an installation wizard each update...you could make your own installation routines that does the same things as an instalation wizard but this will be more difficult for you and only save the user a few occasional clicks. Technically, you should have it first uninstall the old version before installing the new but if you don't do that, it shouldn't cause too many problems as long as you don't register the prog each update. Depending on which installer you are using their should be some way to set that.
|
|
|
|
|
I have a program that needs some way of getting a generic resource and loading it as a normal file. I would prefare to work with io streams, but I don't have too. I know how to load an image or a cursor or an icon, but they just return HBITMAP or HCURSOR or HICON.
Thank you in advanced
|
|
|
|
|
Check out the FindResource() , LoadResource() , and LockResource() APIs, using those you can get the raw data of a resource.
--
I'm Michael Dunn and I approve this post.
Vote Trogdor in oh-four!
|
|
|
|
|
Hi all:
I am still learning c++, so I will try to describe my problem and what I am try to do the best I can.
The basis of my program is to take data from the Serial I/O Port into a character array and analyze it and do all kinds of stuff with it. Right now what I am trying to do is take a byte (I am working with whole numbers, so my byte would = 2 characters) and compare it against a table of possible matches and if the byte matches, go to the function that corresponds with that byte.
I'll give an example here:
Lets say the whole number integer is 48. Now I want to take 48 and compare it against a list of commands (00 to 99) and if one matches go to the routine of that matching number. so when it compared 48 against 48 in the table it would then call the cmd48() function and go from there.
I hope I have been as clear as possible, so that you can understand what it is I am trying to do.
NOTE: I dont think a switch-Break statement would work since it only checks 1 character and obviously I am not working with only 1 character, so I dont know anything else to use.
Thanks
|
|
|
|
|
Your best bet would be to use function pointers in a lookup table. Assuming all the functions return void and take no parameters...
void (*functions[])() = { cmd0, cmd1, cmd2, cmd3 };
...
char string[3] = "48";
int number = atoi(string);
if (number >= 0 && number <= 3)
{
(*functions[number])();
} Just make sure that you never index your array out of bounds, or you'll have huge problems, and the errors probably won't make any sense. The first element in the array will be if a 0 is received, the second element for a 1 received etc.
Hope this helps
PS. Look up a textbook on function pointers if you're not sure how they work.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Im developer of network security. and i have write program that create some PC hiden on network and i have problem of how i can hide logical driver not only in windows explorer but denied fully access to it .
faroq from yemen thammar
working in thammar universty and my intersted about network and security
im programmer from 6 years ago and ihave my B.C from this universty
|
|
|
|
|
For starters, you can remove the C$ and ADMIN$ shares on that machine. You can also go into the LAN Properties dialog and uncheck File and Printer Sharing.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
ineed to remotley send files from one machine to the other by only one program on one machine .
please some source code (VC6)
with my thanks
faroq from yemen thammar
working in thammar universty and my intersted about network and security
im programmer from 6 years ago and ihave my B.C from this universty
|
|
|
|