|
can anyone help me to find a good, recent directx tutorial? i am using visual studio express edition, if that makes a difference. i have looked for a little while without luck. any help provided would be greatly appreciated.
- Kyle
|
|
|
|
|
I am now starting to learn VC++. Can some want share me a good e-book to start!
Thank you!
FILWY
|
|
|
|
|
Programming Windows, 5th Ed by Charels Petzold,
Programming Windows with MFC, 2nd Ed by Jeff Prosise...
That should Do
kss
|
|
|
|
|
I am staring to learn how to interact with MD2 in c++. Can some one give me a basic tutorial!
FILWY
|
|
|
|
|
I am trying to output to the console and trying to center words on the screen. I realize that I cold assume 80 characters can be displayed across - its pretty much the absolute standard these days - but I was wondering if anyone knows a function to get the character width of the console output so that I can use that to be a little more universal in my centering function. Anyone know?
sincerely, Brett Peirce - PolerBear
To err is human; To forgive: divine.
|
|
|
|
|
I found the code that you want in here.
http://www.koders.com/c/fidD1457B7594BFF764B76CFFDBCD7E2EDE2E4188C3.aspx?s=telnet
And I tested it like below, and I could get the result;
// consoletest.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <windows.h>
#include <conio.h>
void SetConsoleSize(HANDLE hConsole, SHORT xSize, SHORT ySize)
{
CONSOLE_SCREEN_BUFFER_INFO csbi; /* hold current console buffer info */
BOOL bSuccess;
SMALL_RECT srWindowRect; /* hold the new console size */
COORD coordScreen;
bSuccess = GetConsoleScreenBufferInfo(hConsole, &csbi);
/* get the largest size we can size the console window to */
coordScreen = GetLargestConsoleWindowSize(hConsole);
/* define the new console window size and scroll position */
srWindowRect.Right = (SHORT) (min(xSize, coordScreen.X) - 1);
srWindowRect.Bottom = (SHORT) (min(ySize, coordScreen.Y) - 1);
srWindowRect.Left = srWindowRect.Top = (SHORT) 0;
/* define the new console buffer size */
coordScreen.X = xSize;
coordScreen.Y = ySize;
/* if the current buffer is larger than what we want, resize the */
/* console window first, then the buffer */
if ((DWORD) csbi.dwSize.X * csbi.dwSize.Y > (DWORD) xSize * ySize)
{
bSuccess = SetConsoleWindowInfo(hConsole, TRUE, &srWindowRect);
bSuccess = SetConsoleScreenBufferSize(hConsole, coordScreen);
}
/* if the current buffer is smaller than what we want, resize the */
/* buffer first, then the console window */
if ((DWORD) csbi.dwSize.X * csbi.dwSize.Y < (DWORD) xSize * ySize)
{
bSuccess = SetConsoleScreenBufferSize(hConsole, coordScreen);
bSuccess = SetConsoleWindowInfo(hConsole, TRUE, &srWindowRect);
}
/* if the current buffer *is* the size we want, don't do anything! */
return;
}
int main(int argc, char* argv[])
{
HANDLE hStdout;
hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
SetConsoleSize(hStdout, 100, 100);
printf("1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890\n");
getch();
return 0;
}
Enjoy
Anderson Sheen
http://www.exteide.com
-- modified at 22:04 Friday 10th February, 20060ff>http://www.exteide.com</a></font></div>
|
|
|
|
|
help me!
when i try to use LowLevelKeyboardHook() to get the keyboardstroke it work well but i can't modify them! i don't understand?
another question!
when i write a code that using LowLevelKeyboardHook() i have to use KBDLLHOOKSTRUCT, i have included <winuser.h> already; but i alway get an error. something like that:
KBDLLHOOKSTRUCT is the missing struct or class.i don't understand again.(i'm using windows XP,and VSC++6.0).
Please help me!
|
|
|
|
|
Did you download latest SDK in here[^]?
But I didn't try to test the func so it's not exactly for the problem.
Enjoy
-- modified at 22:17 Friday 10th February, 2006
|
|
|
|
|
Thanks for reply.
i got two answar first use satan keyword so where to use it?
second one getparentframe().i dont know getparentframe function of which class is it of Document or view plz specify me
sourabh jain
patni computers system
|
|
|
|
|
getparentframe9) works
getActiveDocument in childframe does work also
sourabh jain
patni computers system
|
|
|
|
|
Hi
I have a unicode string. I want to convert it to char array. How can I do it?
Thanks
|
|
|
|
|
char *pAnsiString = new char[nSize+1];
wcstombs(pAnsiString, wcpString, nSize+1);
|
|
|
|
|
int MultiBytetoWideChar(....)
look up the MSDN for detail
路漫漫其修远兮,吾将上下而求索。
|
|
|
|
|
Do you have a unicode string, or a TCHAR string? If it's a TCHAR, use the ATL T2A() macro, as it will work correctly regardless of whether you're compiling for unicode or not.
If it's a true unicode string (using WCHAR), use the WideCharToMultiByte() function.
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"
|
|
|
|
|
Q.1 Write a C Program to display following menu
Menu
1. Display
2. Copy
3. Append
4. Exit
Accept the choice (1-4) from the user, and perform following tasks:
Choice 1: Accept a file name from the user and display the file on screen
Choice 2: Accept two file names, and copy first file to the second
Choice 3: Accept two file names, and append second file to the first file
Choice 4: Terminate the program
Your program should have appropriate validations
============================================================
Q2) Write a C Program to create a structured data file named Student.dat to store the roll no, name and course.
Provide following functions:
Accept the values from the user using structure variables. Store the contents in a file.
Display the file.
The user should be able to add new records to the existing file. And display the new file.
============================================================
Q3) Write a C Program to declare an array for 2 0 floats. Accept the values from the user sort the two arrays in descending order. Merge the two arrays into a new array and display the new array.
============================================================
Q4) Accept any two numbers from the user. Perform the following operations on it using functions:
Addition
Subtraction
Multiplication
Swap the values
Print both the numbers in reverse order for example (if a given number is 234, it should be printed as 432)
thx
|
|
|
|
|
If you need help with your assignment, you need to first attempt to write the program, and, then, ask specific questions.
|
|
|
|
|
That's pretty sad, man. You should at least try. Did you post this word for word from your professor's assigment sheet? If you can't do this simple stuff and are not driven enough to even *try* to figure some of it out, you should probably get out of computer science. It's really not some easy way to make a good salary when you graduate. You have to actually apply yourself to be successful in this industry. Not understanding doesn't make you stupid, but cheating does.
-Matt
------------------------------------------
The 3 great virtues of a programmer:
Laziness, Impatience, and Hubris.
--Larry Wall
|
|
|
|
|
The entire test project can be downloaded at http://www3.telus.net/pja/pja_format.zip. I am planning to write an article on this so I do not mind sharing what I got so far.
This is my header file:
#pragma once
#define USE_STRSTREAM
#ifdef USE_STRSTREAM
#include <strstream>
#else
#include <sstream>
#endif
class pja_format
{
...
public:
template <class T> static const char * tostring (const T &t)
{
#ifdef USE_STRSTREAM
std::strstream s;
#else
std::ostringstream s;
#endif
s.setf(std::ios::fixed);
s.precision(precision);
s << t << std::ends;
#ifdef USE_STRSTREAM
return s.str();
#else
return s.str().c_str();
#endif
}
template<> static const char * tostring (bool b)
{
return b ? "true" : "false";
}
}; I have got the demo working in ANSI if I use strstream, but I want to port it to work with UNICODE now, so I have to switch from strstream to stringstream. The problem is that stringstream seems to totally screw up my programs input. Is it somehow using a shared static buffer? I really do not know what is going on and I am getting totally frustrated.
If someone wants to check it out, download the entire test project from here (4 KB zip)[^] and try it out. comment out the #define USE_STRSTREAM line in the header and see the difference in the output. The really weird stuff happens in the make() member function when trying to read the va_list variables.
Any help would be greatly appreciated.
[EDIT]
I any one is interested in making this a joint project, I do not mind co-authoring the article with someone and sharing the credit. The main thing for me is getting this to work.
[/EDIT]
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
-- modified at 15:51 Friday 10th February, 2006
|
|
|
|
|
I've had a brief look at the code in the debugger (VS 2k5). From what I can see, the va_list magic fails for some reason when USE_STRSTREAM isn't defined. . When USE_STRSTREAM is defined, the VariablesVector contains { format string with \x001s, "This String comes from the Test class - \x0011 \0x0012 \x0013 \x0014", "Hello World", "false" } but when it is not defined, it contains { "", "s", string of 0xCC, "false" }.
I'll see if I can find what's causing it...
|
|
|
|
|
I know what it is that causing the trouble. Dead objects... in both cases actually! But you're lucky in one the cases! Let's consider the #undef USE_STRSTREAM case:
template <class T> static const char * tostring (const T &t)
{
...
return s.str().c_str();
}
s.str() returns a std::string object by value (temporary object). It in turns returns a direct pointer to its internal buffer by use of .c_str(). But... the temporary object dies on returning from the function. So you'll end up returning a direct pointer to the internal buffer of a dead object.
It would seem that you are extremely lucky in the #define USE_STRSTREAM case, as std::strstream seems to leave a seemingly intact buffer after its demise.
|
|
|
|
|
A rookie mistake that I should have seen. Thanks Jorgen.
I was so focused on the stringstream class being the problem that I missed the obvious. Now I just have to figure out a work around so that I can still get my class to do what I want.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
PJ Arends wrote: A rookie mistake that I should have seen. Thanks Jorgen.
It happens to the best every once in a while. Mistakes of this kind often indicates that you need a break. Perhaps it's time for snacks, refreshments and ice hockey?
By the way, I found an error which the VC6 compiler accepts(!)
template<> static const char * tostring<bool> (bool b) should be
template<> static const char * tostring<bool> (const bool& b) .
PJ Arends wrote: Now I just have to figure out a work around so that I can still get my class to do what I want.
How about returning a std::string? I'm not certain about the internals of std::string in any implementation, but I would assume that reference counting and copy on write methods are widely use, which should give little or no penalties for returning such objects.
|
|
|
|
|
Jörgen Sigvardsson wrote: How about returning a std::string? I'm not certain about the internals of std::string in any implementation, but I would assume that reference counting and copy on write methods are widely use, which should give little or no penalties for returning such objects.
I will look into it. The problem may come in how the va_list in the make() function handles std::strings as the type of the variable gets lost in the variable list (at least according to MSDN), which is why I wanted to use char* pointers. I am going to take a break now and look at it again later. Thanks for the help so far.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
Is there an API available to enable/disable Windows SP2 firewall on a given connection?
I’ve read through the Windows SP2 Firewall API, but it seems there is no mean to do this, neither enabling nor disabling “pop3”, “FTP server”…etc on a given connection.
These properties are displayed in the Windows SP2 Firewall GUI under ‘Network connection settings’ of the ‘advanced’ tab! There were some methods to do this with ICS/ICF…
Thanks!
|
|
|
|
|