|
My corrections in bold
int main()<br />
{<br />
int array_2[arr_size][arr_size]; <br />
print_arr(2_array);<br />
return 0;<br />
}
Here's a small example program showing 2 diffrent versions of passing 2-dim arrays
#include < iostream >
using namespace std;
const int arr_size = 5;
void print_arr(int *temp)
{
for (int i = 0;i < arr_size;++i)
{
cout << endl;
for (int j = 0;j < arr_size; ++j)
cout << temp[i*arr_size + j] << " ";
}
cout << endl;
}
void print_arr2(int temp[][arr_size])
{
for (int i = 0;i < arr_size; ++i)
{
cout << endl;
for (int j = 0;j < arr_size;++j)
cout << temp[i][j] << " ";
}
cout << endl;
}
int main(int argc, char* argv[])
{
int array2d[arr_size][arr_size] = {0};
print_arr(&array2d[0][0]);
print_arr2(array2d);
return 0;
}
HTH
Jonas
“Our solar system is Jupiter and a bunch of junk” - Charley Lineweaver 2002
|
|
|
|
|
Oops I posted this in the wrong forum originally, I must learn how this internet thing works some time
Does anyone know of a fast algorithm for fading between 2 large, 24 bit bitmaps?
I use:-
colour = newColour*factor + (oldColour * (1.0 - factor));
when factor is between 0.0 and 1.0, but it is very slow iterating through each colour. Are there any standard (easy) methods in DirectX, Direct3D or any libraries, freeware or commercial etc?
"The greatest mistake you can make in life is to be continually fearing you will make one." - Elbert Hubbard
|
|
|
|
|
|
Thanks,
I really should have spotted that optimisation, i.e. allways use integer calculation if possible. It makes a 40% improvement in the calculation time.
"The greatest mistake you can make in life is to be continually fearing you will make one." - Elbert Hubbard
|
|
|
|
|
This might be obvious to you guys, but I've been trying to figure this out for a while now:
I have 2 panes: Left pane has the tree and right pane is blank. I am trying to display different data depending on what item is selected from the tree on left.
I appreciate any and all the help I can get, as I have tried evryting I can think of.
Thanks,
David
|
|
|
|
|
The reason I need this is that I want to show system specific info. For ex. One branch of the tree would show mem usage, while other branch would show Network card info, i.e. ip address, mac address...
Is this better acomplished with panes or forms?
Thanks,
David
|
|
|
|
|
Hi,
How do I find out if a window (ie non-modal dialog) is currently visible. I've implemented a bool which can monitor it as SW_SHOW or SW_HIDE flags are used to show and hide it, but surely there's a 'native' way of finding this out.
Sorry if this is a real basic question but I can't find the answer in MSDN or the faq here. (I'm probably just not looking in the right place.)
Thanks,
Simon
|
|
|
|
|
How about BOOL IsWindowVisible(HWND hWnd) ?
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Codes I found it in codeproject.
Win32 API style
HWND hwndT;
HWND hWndReturn;
hwndT=::GetWindow(m_hWndMDIClient, GW_CHILD);
while (hwndT != NULL)
{
TCHAR szWndTitle[256];
::GetWindowText(hwndT,szWndTitle,sizeof(szWndTitle)/sizeof(szWndTitle[0]));
if (strcmp (szWndTitle, "YOUR WINDOWS TITLE) == 0)
{
hWndReturn = hwndT;
WINDOWPLACEMENT wndpl;
::GetWindowPlacement((HWND) hwndT,&wndpl);
if(wndpl.showCmd == SW_SHOWMINIMIZED)
::ShowWindow((HWND) hwndT,SW_RESTORE);
::SendMessage(m_hWndMDIClient,WM_MDIACTIVATE,(WPARAM)hwndT,0); //Activates it
}//end if
hwndT=::GetWindow(hwndT,GW_HWNDNEXT);
}//end while
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
I am resizing every control of a dialog, and I'm having problems with non-push like check boxes and combo-boxes. At issue is the "real check box" and the "scroll bar" (the downwards arrow) of combo-box. (The caption of the check box and the item display part of the combo box can be resized, at least partly.)
I'm using SetWindowPlacement for the resizing (it makes no difference if I'm using the Windows function or CWnd). This has no effect on the above components.
I tried it with SetWindowPos; the effect is remarkable.
1. the check box can be shrunk (and it works too!), but it can't be stretched.
2. the combo box can be shrunk in the width but not in the height, and when reducing the width, the "scroll bar" remains the same size (it will be even larger than the size of the control all together). The height can't be changed at all.
Does anyone have some experience with this and know of a solution?
Btw, all this is on XP)
|
|
|
|
|
Does anyone know of any source code/examples/libraries that allow you to burn to cd rom drives?
|
|
|
|
|
|
Do you know of any commercial libraries. I have searched but came up short.
|
|
|
|
|
There is the Nero CD Burning Api (can get it from their website ) and it is really easy. But your customers must have the nero burning rom installed on their computer.
Well... I am a beginner ...
|
|
|
|
|
Does anyone know how to get a screenshot of a window witch is hidden (WS_VISIBLE = 0).
I tried to send WM_PRINTCLIENT to that window, but it doesn't seem to work. I realy need that window to draw itself somehow into a device context I specify.
Please tell me if you know something about this.
Thanks
|
|
|
|
|
How about making it visible for only a few milliseconds and take a screenshot meanwhile?
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Yes I know, I had that idea myself but my boss doesn't like it. There must be some other way. Thanks anyway.
|
|
|
|
|
Be aware that some windows simply can't be made visible. They have no paint routines and/or incomplete settings for the window creation itself. While not as common under Win32, it is still sometimes the easiest way to do some things.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Can anyone point me to an FTP server other than IIS that supports multiple host style directory listing(like UNIX,MSDOS,VMS etc etc). I have tried sambar and cerberus they only support UNIX style.
Thanks ,
amit.
Hush,hush...
thought I heard you call my name now.
Kula Shaker.
Amit Dey
Latest articles at CP - Writing Word addins
Office addin
|
|
|
|
|
Have you looked at RhinoSoft's Serv-U[^]? It is easy to use and powerful.
Kelly Herald
Software Developer
MPC
|
|
|
|
|
I only try to add a new message ,this is my first.
Let us rap off,for you,for me,for our man!
|
|
|
|
|
then we all hope that this will remain your first message!
Don't try it, just do it!
|
|
|
|
|
|
|
hi everyone,
i got the following problem: i'm writing a program taht exchanges xml-messages over a network and i use IXMLDOMDocumentPtr ' s to generate (and parse) the xml message.
my problem is that after memory allocated for the xml-docs remains allocated even after i load sth new into the IXMLDOMDocumentPtr so my prog keeps getting bigger and bigger.
here's how the thing works:
Parse(BSTR theXML)
{
IXMLDOMDocumentPtr theXMLDoc;
::CoInitialize(NULL);
theXMLDoc.CreateInstance(CLSID_DOMDocument);
theXMLDoc->loadXML(theXML);
//do something
theXMLDoc.Release();
}
so what did i miss?
i also tried taking the ::CoInitialize(NULL) out of there and put it into the constructor of the class, but then i always get errors while trying to .CreateInstance(..) because "CoInitialize has not been executed"
|
|
|
|