|
It looks like homework.
find the minimum number of rows for an unspecified 2D array.
"It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan
That's what machines are for.
Got a problem?
Sleep on it.
|
|
|
|
|
|
|
Quite, I couldnt agree more.
==============================
Nothing to say.
|
|
|
|
|
What is wrong on this code:
CButton* pButton = (CButton*)GetDlgItem(IDC_BUTTON_AMP_1);
CDC *pDC = pButton -> GetDC();
pDC->MoveTo(10, 10);
pDC->LineTo(30, 30);
I want simple draw a line on button. But tis program does not work.
|
|
|
|
|
Is your button created with the BS_OWNERDRAW style ?
Is the code in the DrawItem method ?
Nihil obstat
|
|
|
|
|
Member 9891334 wrote: CButton* pButton = (CButton*)GetDlgItem(IDC_BUTTON_AMP_1);
Is pButton good (not NULL) after this line?
|
|
|
|
|
I don't do much with buttons like this, but when are you deciding to draw?
Someone else can chime in, but if you don't invalidate the button, windows will discard the drawing.
Charlie Gilley
<italic>You're going to tell me what I want to know, or I'm going to beat you to death in your own house.
"Where liberty dwells, there is my country." B. Franklin, 1783
“They who can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety.” BF, 1759
|
|
|
|
|
using the pBtn->Invalidate() to refresh the button
|
|
|
|
|
I need to place a bitmap on button. I am working with eVC++.
|
|
|
|
|
You need to create a button with the BS_BITMAP style.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Hi everyone, I have a HBITMAP with alpha channel information. The alpha channel should already be premultiplied.
Nevertheless, when using GDI's AlphaBlend(..) function, the bitmap seems to have "black borders", means the semi-transparent areas are simply black.
Does this mean I am doing something wrong? Or is AlphaBlend that limited?
I guess I should avoid legacy GDI AlphaBlend, maybe some has a clue what alternatives I'd have for a dialog based application?
Is there something better in GDI+ for bitmaps with transparency? I am not really convinced to go for D2D for this bitmap only.
Cheers, Don Rolando
|
|
|
|
|
I think GDI+ will be better for bitmap to transplant
|
|
|
|
|
I'm developing on OS X 10.8.3. The following code is simple. It can perform two operations. If the read function is uncommented then the program will open the file at "address" and transfer all of its contents into data. If instead, the memcpy function is uncommented the program will copy the mmapped contents into data. I am developing on a mac which caches commonly used files in inactive memory of RAM for faster future access. I have turned off caching in both the file control and mmap becuase I am working with large files of 1 GB or greater. If i did not setup the NOCACHE option, the entire 1 GB would be stored in inactive memory.
If the read function is uncommented, the program behaves as expected. Nothing is cached and everytime the program is ran it takes about 20 seconds to read the entire 1 GB.
But if instead the memcpy function is uncommented something changes. Still i see no increase in memory and it still takes 20 seconds to copy on the first run. But every execution after the previous one, copies in under a second. This is very analogous to the behavior of caching the entire file in inactive memory, but I never see an increase in memory. Even if I then do not mmap the file and only perform a read, it performs in the same time, under a second.
Something must be getting stored in inactive memory, but what and how do I track it? I would like to find what is being stored and use it to my advantage.
I am using activity monitor to see a general memory size. I am using Xcode Instruments to compare the initial memcpy execution to an execution where both read and memcpy are commented. I see no difference in the Allocations, File Activity, Reads/Writes, VM Tracker, or Shared Memory tools.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/mman.h>
int main(int argc, const char * argv[])
{
unsigned char *data;
unsigned char *mmapdata;
size_t length;
int file = open("address", O_RDONLY);
fcntl(file, F_NOCACHE, 1);
struct stat st;
stat("address", &st);
length = st.st_size;
data = malloc(length);
memset(data,0,length);
mmapdata = mmap(NULL, length, PROT_READ,MAP_SHARED|MAP_NOCACHE, file, 0);
if (mmapdata == MAP_FAILED)
fprintf(stderr, "failure");
// read(file,data,length);
close(file);
// memcpy(data,mmapdata,length);
munmap(mmapdata,length);
free(data);
return 0;
}
|
|
|
|
|
This seems more a question for a MacOS, rather than a C++ coding, forum.
Use the best guess
|
|
|
|
|
Is there a mac/OS X forum here? I couldn't find one and since this is in C i posted it here.
|
|
|
|
|
Member 9993401 wrote: Is there a mac/OS X forum here? No, this site is predominantly Windows focused.
Use the best guess
|
|
|
|
|
I have hWnd of main window of other process and I need to increase priority of this thread or process. How to do it?
|
|
|
|
|
|
I need a counter in C++ to my windows form.
Code:
int counter60
counter60 ++;
Counter->Text = System::Convert::ToString(counter60);
I only counts to 1, first time i klik the button. I have it under my Button click.
What is wrong here ?
|
|
|
|
|
At a guess, since you did not provide the relevant code, you are initializing counter60 to 0 every time on your button click and incrementing it to 1.
And this is C++/CLI and should have been posted in the appropriate forum.
|
|
|
|
|
You need to put your counter variable in the class; or make it a static variable.
Now, I assume you re-create the variable each time you click on the button.
(in c++, pseudo-ish code....)
class YourClass
{
YourClass();
int m_Counter;
void OnButtonClick();
}
YourClass::YourClass () : m_Counter(0)
{
}
void YourClass::OnButtonClick()
{
m_Counter++;
Counter->Text = System::Convert::ToString(counter60);
}
Nihil obstat
|
|
|
|
|
How do you mean "Re-create" ?
I am kind of a rookie.
I use Visual c++ 2010.
|
|
|
|
|
Do you have to call an updatedata() type func like in MFC to refresh the GUI?
If not debug it, it shoud be 61 not 1. Step into the converttostring and make sure you get the right string back, then step into the ->Text func and make sure its being set.
==============================
Nothing to say.
|
|
|
|
|
> This < should help.
"It's true that hard work never killed anyone. But I figure, why take the chance." - Ronald Reagan
That's what machines are for.
Got a problem?
Sleep on it.
|
|
|
|