|
Anonymous wrote:
This error occurs if i #include "GlobalVariables.h" in each class.
I have NEVER found it a good practice to declare variables in a header file. Sure, you can be clever and use a set of #ifdef... statements in a header, but this ends up hiding your true intent, although syntactically it works just fine.
I would suggest (as a regular practice) to declare your global vars at the beginning of some main file outside the scope of anything (to make them global) and then explicitly use extern in all the other source files where you know you need that global variable.
That makes it very specific as to what you are doing, and when you (or someone else) ever needs to read that file and try to find something, they won't have to trace through a set of header files looking for the proper setting of the #defines.
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|
|
In my application there is a Progress Bar in the main Dialog , which needs to be updated when a process is running, its working fine if single thread is running, but updation is not happening incase of multiple Threads. (Main Thread should update the Progress Ctrl, and the counter will be updated by worker thread).
What could be the reason for this behaviour. Any suggesstions.
Thanks in advance.
Warm Regards,
KKR
|
|
|
|
|
One solution is messages. Send messages to the main thread and have it update the progress control.
Kuphryn
|
|
|
|
|
I have problem in Changing the tray icon.I am using two class.
1.CTrayMenu and 2.CConnectionMgr.
In WinMain(server) I create an instance of CTrayMenu Icon and started the trayicon when program begins
But I can't change the tray icon when client connected to server.I want to modify the tray icon.
here is some part of my code...
Main Program
----------------
HANDLE mainHandle;
mainHandle = CreateSemaphore(NULL,0,1,NULL);
CTrayMenu *TrayMnu = new CTrayMenu(hInstance);
TrayMnu->start();
TrayMnu->m_pConnectionMgr = new CConnectionMgr(hInstance, mainHandle);
CTrayMenu Class
-----------------
void CTrayMenu::SendTrayMsg(DWORD msg, BOOL flash)
{
// Create the tray icon message
m_nid.hWnd = m_hwnd;
m_nid.cbSize = sizeof(m_nid);
m_nid.uID = IDI_WINTRAY; // never changes after construction
m_nid.hIcon = flash ? m_flash_icon : m_tray_icon;
m_nid.uFlags = NIF_ICON | NIF_MESSAGE;
m_nid.uCallbackMessage = WM_TRAYNOTIFY;
if (LoadString(hAppInstance, IDI_WINTRAY, m_nid.szTip, sizeof(m_nid.szTip)))
{
m_nid.uFlags |= NIF_TIP;
}
// Send the message
if (Shell_NotifyIcon(msg, &m_nid))
{
// Set the enabled/disabled state of the menu items
}
}
What will I do?
Help me...........
Thanks
boby
|
|
|
|
|
Hi!!!
I am trying to load a jpeg file as a resource.For that I need to read a .jpg file into a buffer. I am using Win32 API and VC6.Any suggestions r welcome.
|
|
|
|
|
CxImage class has a LoadResource() method.
|
|
|
|
|
|
Thanx guys. I managed to do it with OleLoadPicture() with the help of a article from Dr. Yovav.
http://codeguru.earthweb.com/bitmap/CPicture.html
|
|
|
|
|
Is there any expert who can answer this question in this world?I am frustrated for i have posted this in so many forums and no answers.
Sir i need to develop a software where i have to change the ascii character into extended ascii character and send to the active application. say if a user type A from the keyboard it should be converted to say € irrespective of whatever the application is running may be it is visual studio or word or notepad or photshop u name it.
Sir i need the codings for this project and if anyone can provide or suggests ideas it is greatly appreciated.
|
|
|
|
|
this may be possible if you use some system-wide hook.
|
|
|
|
|
u can do that using a WH_KEYBOARD hook as a system hook (placing it in a dll)
bye bye
marconi (jca)(ecc) - inocram@yahoo.com
lo normal es aburrido
http://mwin32asm.cjb.net/
|
|
|
|
|
Project Description
________________________
Keyboard
________________________
|
V
--------------------------------------------
Keyboard Hook (I have done this part)
--------------------------------------------
|
V
--------------------------------------------
Getting the Key Pressed or (I have done this part)
combination of the key pressed
---------------------------------------------
|
V
___________________________
problem i have is changing this
character into extended Ascii
character and sending to the
active application (system Wide)
???????????????????????
???????????????????????
___________________________
Is any expert there who can help me on this???
|
|
|
|
|
I have good at math. But now I am a Network Administrator, I knowlege about OS and TCP/IP and security. Iwant to faster become a good C++ programmer. Please help me ? what will I do ?
Thank you !
Ngo Hong Quyet
|
|
|
|
|
READ CODE WRITTED BY OTHER MAN.
|
|
|
|
|
i agree with him. I don't have any CS background but reading other poeple's code and some books i am active coder now.
Good suggestions. Worked for me
paracha3
|
|
|
|
|
Thanh you !
Can you give me some template code or some link !
Ngo Hong Quyet
|
|
|
|
|
Hello everybody,
I have a problem in VC6. I have downloaded core sdk 2003.
I am not sure whether I installed it properly
or not. After download was completed, I ran setenv.bat .This bat file
I didnt have in my machine and copied only that file from another machine.
Any path setting should be done? how to do it?
can anyone help me?
When I run my application I get an error C2065: undeclared identifier.
regards,
shezz
|
|
|
|
|
I make soft for smartphone in evc4.
And it has not a customer wizard application,I can not make a awx file for my IDE.How could I do this?
lost my way
|
|
|
|
|
ok how do you load text from a text file to memory or somewhere so I could do a search on it for a specific character, can anyone help me, also how can you tell which line your on, THANKYOU SO MUCH everyone...
IF IT DOES THE THINGS I WANTED THE PROGRAM TO DO, I WILL POST THE ARTICLE ON CP.
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
The text file = "Data.txt"
123
4567
89;
135
2468
The sample code...
#include <iostream>
#include <fstream>
void main()
{
std::ifstream MyFile("Data.txt");
MyFile.seekg(0, std::ios_base::end);
int iEnd = MyFile.tellg();
MyFile.seekg(0, std::ios_base::beg);
int iStart = MyFile.tellg();
int iSize = iEnd - iStart;
char* p = new char[iSize + 1];
MyFile.read(p, iSize);
int iLine = 0;
if(iSize)
iLine = 1;
for(int i = 0; i < iSize; i++)
{
if('\n' == p[i])
iLine++;
if(';' == p[i])
std::cout << iLine << " lines\n";
}
MyFile.close();
delete []p;
}
Then you can do yourself to make the code more stylish, more modularized...
Maxwell Chen
|
|
|
|
|
Thankyou again, I have one more question for today , how can you add the lines until the first ' ; ' and then see if there are others after it, if so then how many lines after that and then do it again until it reaches end of file. Store the number of lines to a seperate variable for furthur finding, would be great if it would be an array? AGAIN THANKYOU!!!;P
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
I recently was in a little discussion and a question came up.
Does a variable that is passed by reference have the same address as it would if it was pointed to?
How would I prove or diprove this?
Thanks for the help in advance.
Jeff Patterson
Programmers speak in Code.
http://www.anti-dmca.org[^]
|
|
|
|
|
Yes they are. To prove it:
BOOL TestAddr(int& ref, int* ptr)
{
return (DWORD)&ref == (DWORD)ptr;
}
void main()
{
int n;
assert(TestAddr(n, &n));
}
|
|
|
|
|
|
<br />
void f(int& v)<br />
{<br />
printf("var in function: %u\n", &v);<br />
}<br />
<br />
int main()<br />
{<br />
int v;<br />
printf("var in main: %u\n", &v);<br />
f(v);<br />
}<br />
If these outputs are the same, then the pointers are the same. These HW assignments are fun. Even a monkey could do them.
J.
----------------------------
|
|
|
|